practice Algorithms with Javascript