0
JavaScript intermediate quiz
Fill in blanks to make the variable arr3 look like the following: [1, 2, 3, 4, 5, 6, 7, 8]. const arr1 = [1, 2, 3]; const arr2 = [5, 6, 7, 8]; let arr3 = [ âŠarr1, 4,...arr2];
9 Respostas
+ 1
I just copy/pasted your snippet to check. It seems you have something that appears on screen like the spread operator `...` but it is not.
That was written in the line where <arr3> was defined, next to <arr1>.
I removed that `...` before <arr1>, type three dots in there, and it works.
let arr3 = [...arr1, 4, ...arr2];
Don't forget to log <arr3> in the console in case it was part of the task requirement :-)
+ 1
Ipang I found the same thing like the '...' ( buggy ? )
But this code does work and display the correct unpacked array
const arr1 = [1, 2, 3];
const arr2 = [5, 6, 7, 8];
let arr3 = [...arr1, 4, ...arr2];
console.log(arr3); // Output: [1, 2, 3, 4, 5, 6, 7, 8]
Without the '...' before arr1
// Output [[1,2,3],4,5,6,7,8]
and Andra Venkata Ramana Rao I ran that both here and on the online-compiler with same results
0
It shows wrong
0
What is the right one
0
The same code in online compiler shows no error. But in quiz it shows wrong
Please check and show the key
0
Which online compiler?
What did you mean key? I had pointed out the part with syntax issue, and provided a workaround....
0
Keyboard key. Full stop key i am using
0
In sololearn quiz that bit shows wrong
I lost more than 15 hearts. How can i complete the quiz