Cognizant interview question

js array methods