Antra Interview Question

How to implement a problem in JavaScript.