Implementation of popular sorting algorithms in JavaScript