-2

I simplified the code below so it seems dum but the problem I have is since I push the array to another array, the sample is an array that has another array.

  const sample = [];
  const test = ["a", "b", "c", "d"];

  sample.push(test);

  console.log(sample);

current sample outcome

[["a", "b", "c", "d"]]

I just want to have one array and is that possible?

Happy1234
  • 537
  • 3
  • 15

1 Answers1

1

This worked!

sample.push(...test)
Happy1234
  • 537
  • 3
  • 15