mergesort in javascript