Which JavaScript method joins two or more arrays?
Correct answer
B. concat()
12 views
B. concat()
12 views
concat() joins two or more arrays and returns a new array without changing the originals: [1, 2].concat([3, 4]) gives [1, 2, 3, 4].
join() converts one array into a string; merge() and combine() do not exist.
For more solved questions like this one, see Computer Science MCQs on MCQsExam.com.
Asked in: Matric,FBISE
Not sure why the answer is B? Ask here and get an explanation.