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 !

18th Mar 2023, 6:04 PM
Hamza Mansour
Hamza Mansour - avatar
4 ответов
+ 2
please show your code
18th Mar 2023, 7:10 PM
Lisa
Lisa - avatar
+ 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.
19th Mar 2023, 9:00 AM
Lisa
Lisa - avatar
+ 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 🤦🏻‍♀️
9th Mar 2024, 12:35 PM
Brandi Hubbard
Brandi Hubbard - avatar
0
const arr1 = [1, 2, 3]; const arr2 = [5, 6, 7, 8]; let arr3 = [… arr1, 4, …arr2];
19th Mar 2023, 8:53 AM
Hamza Mansour
Hamza Mansour - avatar