0
I want to runAgain prompt to ask Enter the color again
let runAgain = true; while(runAgain){ let color = prompt("Enter color") document.body.style.background = color runAgain = confirm("do you want to right again") } This runAgain is not working how to solve it?
8 Antworten
+ 4
Great, thanks. Try this in the Web code:
window.onload = function () {
let runAgain = true;
while(runAgain){
let color = prompt("Enter color");
document.body.style.backgroundColor = color;
runAgain = confirm("Do you want to write again?");
}
};
+ 2
Save the code as public and I can attach it here for you.
+ 2
Thanks for your time Ausgrindtube
+ 1
For starters, your while statement will be without end (I.e. infinite) because you don't have an exit condition, something that sets it to false or break.
+ 1
Can you attach your code from the code playground using the plus ➕️ button here please?
0
Do you write it to me?
0
Its not showing here
0
I set it as public