Intermediate javascript Quizz | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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 Respostas
+ 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
+ 1
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