Algorithms with JavaScript