Infosys interview question

Question on reactjs and javascript