Practicing sorting algorithms in nodejs