To merge two arrays into a single array, you can use the _______ method.
- merge()
- concat()
- join()
- combine()
The correct method is concat(). The concat() method is used to merge two or more arrays into a single array. It doesn't modify the original arrays but returns a new array containing the elements from the source arrays. For example, const mergedArray = array1.concat(array2); merges array1 and array2 into mergedArray.
Loading...
Related Quiz
- In order to make an object iterable with a for...of loop, you need to define its _______ method.
- The querySelector method uses _______ selectors to select elements.
- In which scenario might a closure be particularly useful?
- The mechanism of closing over variables is a core concept in ________ programming in JavaScript.
- Which design principle is violated if a superclass is aware of its subclasses?