1.

What will happen if reverse() and join() methods are used simultaneously?(a) Reverses and stores in the same array(b) Reverses and concatenates the elements of the array(c) Reverses(d) Stores the elements of an array in normal orderThe question was asked in an online interview.My question is taken from Array and Related Methods topic in division Lexical Structures of JavaScript

Answer»

Correct OPTION is (a) Reverses and STORES in the same array

Easiest explanation: The array.join() METHOD is an inbuilt function in JavaScript which is USED to join the elements of an array into a string. The reverse() followed by a join() will reverse the respective array and will store the REVERSED array in the memory.



Discussion

No Comment Found

Related InterviewSolutions