0
Intermediate javascript Quizz
Hello, there seem to be a problem in the interesiate javascript quizz where we have to concat two arrays and add number « 4 » in the new array, where the answer is logicaly as follows: arr1, …, 4. But for some reason it doesn’t work !
4 ответов
+ 2
please show your code
+ 2
const arr1 = [1, 2, 3];
const arr2 = [5, 6, 7, 8];
let arr3 = [...arr1, 4, ...arr2];
console.log(arr3);
Do not put linebreaks within code lines. The unpacking of arrays is done with 3 single dots, not with the … identity.
In you current code "4" is in the middle of the new array.
+ 2
I know this is old, but I searched for this topic, and here I am.
I lost so many hearts on this bloody question, all because of a formatting issue. I thought I was going crazy.
I’m on iPhone. Typing three dots elsewhere, then copying and pasting them into the box prevents the dots from being formatted as an elipsis. You will then get the correct answer 🤦🏻♀️
0
const
arr1
= [1, 2, 3];
const arr2 = [5, 6, 7, 8];
let arr3 = […
arr1,
4,
…arr2];