Cognizant interview question

Medium questions on java script.