loading...

re: 2 Ways to Merge Arrays in JavaScript VIEW POST

FULL DISCUSSION
 

From example "A. Using Spread"

I think forgot put "..." before "array2"

function combineArray(array1, array2) {
  return [...array1, array2]; // <-------------- HERE
}

const isArray = [1,2,3];
const notArray = 'random';

combineArray(isArray, notArray);
// 😱 [ 1, 2, 3, 'r', 'a', 'n', 'd', 'o', 'm' ]

sorry if i'm wrong.

 

Ahhhh my mistake 😱 Thank you for letting me know 👍

code of conduct - report abuse