JS Arrays | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

JS Arrays

Fluffy Pancakes The array you are given represents the menu of breakfast options available at the hotel. The Chef decided to replace one of the options with "Fluffy Pancakes". Write a program to take the index as input, replace the element with that index with "Fluffy Pancakes", and output the new menu to the console as an array. /* I find JavaScript maddening at this point, but I refuse to give up. Can someone please help me to understand what the error or omission is here? Thank you. */

30th Jan 2022, 9:54 PM
Tahiti🌍Castillo
Tahiti🌍Castillo - avatar
9 Answers
+ 7
Tahiti🍷Castillo , I did not remember whole description of the task. I see your code is correct. You just need to change [fluffy pancakes] in '.....' single inverted rather than double inverted. Because your array of breakfast indexes has breakfast items in '.......' and not "......" #change done on line 16 check out the solution in case if gets solved. https://code.sololearn.com/cYW64L1Wxbl8/?ref=app
31st Jan 2022, 3:38 AM
Shivani 📚✍
Shivani 📚✍ - avatar
+ 2
Solomoni Railoa Thank you for this solution. They haven’t yet covered < for let …. in > at the point where I am in the JS tutorial, but it’s a concept I’ve seen outside of SoloLearn. It’s very helpful to see how it can be used to solve this task. Thank you!
31st Jan 2022, 12:25 AM
Tahiti🌍Castillo
Tahiti🌍Castillo - avatar
+ 1
It seems that my code isn’t uploading. Trying again here. https://code.sololearn.com/chqRRoU6oOuc/?ref=app
30th Jan 2022, 9:56 PM
Tahiti🌍Castillo
Tahiti🌍Castillo - avatar
+ 1
I tried messing around with you code using kotlin I broke down how you can use it to write yours in java now all you need to do is find out how to replace the index ..with what ever .. https://code.sololearn.com/cCtZg8Iy1mL6/?ref=app
31st Jan 2022, 12:14 AM
Ion Kare
Ion Kare - avatar
+ 1
Ion Kare Thank you for sharing this. 😵‍💫 I see I have a lot more studying to do. Kotlin is on my list of languages to learn, but your demo is actually my first look at Kotlin. Also, I’m working with JavaScript. Did you mean to reference Java? Or JavaScript? Thanks again.
31st Jan 2022, 12:33 AM
Tahiti🌍Castillo
Tahiti🌍Castillo - avatar
+ 1
Javascript , but I started to learn javascript but those semi Colin's xD
31st Jan 2022, 12:37 AM
Ion Kare
Ion Kare - avatar
+ 1
Solomoni Railoa I will revisit 18.1 Thank you. I tried your code and it gave an error. I updated the code bit, which shows the same error given in the Code Coach. https://code.sololearn.com/chqRRoU6oOuc/?ref=app
31st Jan 2022, 1:16 AM
Tahiti🌍Castillo
Tahiti🌍Castillo - avatar
+ 1
Shivani 📚✍ Thank you for pointing this out. I hadn’t even noticed the single vs double quotes. I will make that update. Thanks!
31st Jan 2022, 3:59 AM
Tahiti🌍Castillo
Tahiti🌍Castillo - avatar
+ 1
👍
1st Feb 2022, 6:30 PM
Jahongir Normurotov 16 Years