Antra interview question

How to implement a problem in JavaScript.