Nimap infotech interview question

js tricky question , dsa in javascript.