implementations of merge and bubble sort in javascript