Please me to correct my code, that when you click a, you output alert("You won\n2 points") and when you click b, c you output al | Sololearn: Learn to code for FREE!

0

Please me to correct my code, that when you click a, you output alert("You won\n2 points") and when you click b, c you output al

let u = prompt("How many colors does a rainbow have? а). 7 b). 6 c). 8"); let n = ["a", "b", "c"]; if (n[0]==true){ alert("You won\n2 points"); } else { alert("You lose\n0 point"); }

4/12/2021 10:07:40 AM

Тимур Завьялов

3 Answers

New Answer

+3

let u = prompt("How many colors does a rainbow have?\n\nа). 7\nb). 6\nc). 8"); if (u.toLowerCase() === "a" ) { alert("You won\n2 points"); } else { alert("You lose\n0 point"); }

+1

Ipang, thank you, I've already wrestle my brain over this task)

0

No worries, You'll get the hang of it 👍