Tribial refactor of bubble sort js