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"); }

12th Apr 2021, 10:07 AM
Тимур Завьялов
Тимур Завьялов - avatar
3 Respostas
+ 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"); }
12th Apr 2021, 10:18 AM
Ipang
+ 1
Ipang, thank you, I've already wrestle my brain over this task)
12th Apr 2021, 10:27 AM
Тимур Завьялов
Тимур Завьялов - avatar
0
No worries, You'll get the hang of it 👍
12th Apr 2021, 10:28 AM
Ipang