Unexpected output | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Unexpected output

There is something wrong with this output, I tried to adjust but I haven't the sufficient experience for do it, I need to take off the - undefined- from the output, I think that, the problem, maybe, is with the loop statement, but I don't know how to fix it up, and I don't want to rewrite it, if there is a good soul that it know how to do, please come to help me. Thank you for your kindness support. https://code.sololearn.com/W7feQ9OIjG69/?ref=app

28th Oct 2018, 4:22 AM
¥^$#°√€
¥^$#°√€ - avatar
6 Answers
+ 5
So you want "Jasmine" to become "Ayasminy"? https://code.sololearn.com/Whdwi0hCslYC/?ref=app
28th Oct 2018, 6:08 AM
Hatsy Rei
Hatsy Rei - avatar
+ 4
Super Hatsy Rei, ok now I have understand, sorry for the answer before maybe I wrote the uncorrected statement, I misunderstood. Now it's work perfectly 👍🙏
28th Oct 2018, 6:22 AM
¥^$#°√€
¥^$#°√€ - avatar
+ 3
Can't you just assign an empty string literal to name1? I'm not sure what you are trying to achieve, so forgive me if this is a flaw instead of a fix, but I suppose I'm getting good output. var name1 = "";
28th Oct 2018, 5:11 AM
Hatsy Rei
Hatsy Rei - avatar
+ 2
On line 5, var name1 = name[x] You were using x before x was initialized.
28th Oct 2018, 4:41 AM
Hatsy Rei
Hatsy Rei - avatar
+ 1
Sorry, thanks for your support but I still not understand, because I tried in your manner but how i told you before,a part of the code doesn't exit, precisely the name1(the whole name without the first and last letter). I will to write the pig Latin name like this "Ay" +the name without the first and last letters and then the first letter with the final letter and this "y" for final. Anyways I really appreciated your support.
28th Oct 2018, 5:35 AM
¥^$#°√€
¥^$#°√€ - avatar
0
Thank you,but I tried to write after the x, but it didn't work.the name1 didn't exit. Hence where do you write the line 5 for to output the whole outcome.
28th Oct 2018, 4:59 AM
¥^$#°√€
¥^$#°√€ - avatar