+ 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. */
11 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
+ 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!
+ 1
It seems that my code isnāt uploading. Trying again here.
https://code.sololearn.com/chqRRoU6oOuc/?ref=app
+ 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
+ 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.
+ 1
Javascript , but I started to learn javascript but those semi Colin's xD
+ 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
+ 1
Shivani šā Thank you for pointing this out. I hadnāt even noticed the single vs double quotes. I will make that update. Thanks!
+ 1
š