Infosys Interview Question

One programming question in JavaScript