Infosys interview question

One programming question in JavaScript