Lab49 Interview Question

Implement an algorithm in JavaScript.