+ 1

JavaScript intermediate quiz Solved

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];

1st Nov 2024, 4:06 PM
Andra Venkata Ramana Rao
31 odpowiedzi
+ 2
Andra Venkata Ramana Rao good to hear that. 😎 Just curious, if you typed out the same thing in the javascript tab of a web codebit, then console.log(arr3); would it work normally? Or would you get an error? Just to see if the problem is in the Sololearn code coach validator or in your keyboard output... There was an issue with the Apple keyboard preference auto replacing dot-dot-dot with the ellipses character, but that was 2013, a long time ago, and was in the Mail.app. But maybe you have something similar enabled in your settings somewhere? I disable keyboard auto replace and auto correct by habit so I don't get nasty surprises like these. quotation marks is one other symbol that gets replaced with look-alike illegal characters. https://discussions.apple.com/thread/5526395?sortBy=rank https://sololearn.com/compiler-playground/WFUi8Gz2M0wq/?ref=app
3rd Nov 2024, 2:15 PM
Bob_Li
Bob_Li - avatar
+ 3
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
1st Nov 2024, 8:17 PM
BroFar
BroFar - avatar
+ 3
Andra Venkata Ramana Rao use three '.', don't use the '…' character. It is not the same thing as '...' (3 separate .) It might look similar but they are not the same thing. The quiz input can accept multiple characters.
2nd Nov 2024, 12:35 AM
Bob_Li
Bob_Li - avatar
+ 3
Andra Venkata Ramana Rao last module what lesson?
2nd Nov 2024, 3:53 AM
BroFar
BroFar - avatar
+ 3
Finally my quiz completed I just copied three dots from exersise and pasted here. Then it accept Thank you very much one and all who support regardig this isse THANK YOU VERY MUCH ALL
3rd Nov 2024, 2:11 PM
Andra Venkata Ramana Rao
+ 2
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 :-)
1st Nov 2024, 5:45 PM
Ipang
+ 2
do not put space between them and also no space at the end
2nd Nov 2024, 3:33 AM
Bob_Li
Bob_Li - avatar
+ 2
Andra Venkata Ramana Rao if you ever get it to pass, please tell us what you did so it will help others in the future.
2nd Nov 2024, 5:00 AM
Bob_Li
Bob_Li - avatar
+ 2
Apologize for such late a reply, things were a bit crowded today :D Hope there'll be a clear explanation on this matter cause as Bob_Li said, it would do a big help to other learners who encounters this anomaly in the future :-)
2nd Nov 2024, 3:00 PM
Ipang
+ 2
Hi Andra, It's good to hear you have got through, good job! I'm not sure whether it was Apple device specifics, but a quick test of the code in programiz, as BroFar sir said, resulted in same issue. The three dots next to <arr1> is considered bad syntax. In programiz's playground the three dots next to <arr1> and <arr2> was noticeably different in the code editor. P.S. Can you please update the original post to add [SOLVED] in the title, as a notification for those who searches for similar casea, that thia case had been solved. And to be more relevant, change the tags to 'Javascript-quiz'. Tags are searchable keywords and to use relevant tags means help the search engine does its work better :-)
3rd Nov 2024, 3:04 PM
Ipang
+ 1
Which online compiler? What did you mean key? I had pointed out the part with syntax issue, and provided a workaround....
1st Nov 2024, 6:05 PM
Ipang
+ 1
In sololearn quiz that bit shows wrong I lost more than 15 hearts. How can i complete the quiz
1st Nov 2024, 6:12 PM
Andra Venkata Ramana Rao
+ 1
Yes sir
2nd Nov 2024, 4:41 AM
Andra Venkata Ramana Rao
+ 1
If you look in the comments lots of people seem to have this issue.
3rd Nov 2024, 5:11 AM
Zvi
Zvi - avatar
0
It shows wrong
1st Nov 2024, 4:07 PM
Andra Venkata Ramana Rao
0
What is the right one
1st Nov 2024, 4:08 PM
Andra Venkata Ramana Rao
0
The same code in online compiler shows no error. But in quiz it shows wrong Please check and show the key
1st Nov 2024, 5:53 PM
Andra Venkata Ramana Rao
0
Keyboard key. Full stop key i am using
1st Nov 2024, 6:08 PM
Andra Venkata Ramana Rao
1st Nov 2024, 6:10 PM
Andra Venkata Ramana Rao