0
Why my function do not work? If else
function sayHello(name) { alert("Hi, " + name); } sayHello("David"); function door(level) { if (level < 10) { alert("return after " + bcd + " levels");} else (level >= 10) { alert("you can pass"); } } level = 6 bcd = 10 - level door(7) door (11) https://code.sololearn.com/WO8zAfu0E633/?ref=app
3 Respuestas
+ 5
kaspars kaspars change else to else if.
When you are going to check condition in else part you need to do like this:-
else if(level >= 10) {
}
if there is no condition then just write else like this:-
else {
}
+ 2
Remove the condition statement from the else part
0
I don't unswratans what to remove , what is condition statement? This code is just printing everything not just one of the answers even if I changed if to else or removed } } from else
and now I get a goddamn uncaught reference error on line 20, what's wrong I can't figure it out :(
https://code.sololearn.com/WO8zAfu0E633/?ref=app