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

While loop issue

I am having an issue with this exercise: It states... Write a while loop that will prompt the user If they would like to print their name. If the answer is yes, log their name to the consul that prompt them if they would like to print their name again. If yes, log their name to the council again but this time add an exclamation point at the end of the string. Continue to add an exclamation point for every time they use her agrees to wanting to print his or her own name.

9th Mar 2018, 1:55 AM
Kwame' Hampton
Kwame' Hampton - avatar
1 Answer
+ 5
var x=1; while(confirm("Do you want to print your name")) { var name = prompt("please enter your name"); if(x==1) console.log(name); else { name = name+"!"; console.log(name); } x++; }
9th Mar 2018, 3:20 AM
cHiRaG GhOsH
cHiRaG GhOsH - avatar