Standard Algorithms in JavaScript