+ 2
What is wrong with my code?(Javascript)can't complete lesson:("organized Bot Task" else-if Statements)
let color = ("green"); /* red => 1 green => 2 black => 3 other cases => unknown */ if (color=="red"){ console.log(1); } else if (color=="green"){ console.log(2); } else if (color =="black"){ console.log(3); } else { console.log("unknown"); }
2 Antworten
+ 3
SKB ,
You hard-coded the input... instead taking input from the user...
Use prompt statement to receive input from user...
let color =prompt("Enter color:");
+ 2
Thank you-That helped:)