Why my function dosen’t work? Please help to figure out.
could you be more specific please. what is the expected output, what are you hoping to achieve?
As @FrankDupree said, would do you expect it to do? Because it does work.
your if...else
doesn’t return anything. When you call seats()
or noseats()
, the value is returned to the if...else
but doesn’t go anywhere from there. Try using return noseats()
/seats()
it dosen’t work for a page
could you please to edit my function. please.
Oh, missed that it didn’t return anything, since the alert worked, my bad.
if(num_pas > cap){
return noseats();
}else{
return seats();
}
It worked. But something confuse me)
I forgot - “return”, that it’s all ?
Yes. So your function did run, so the alert went off. But since you didn’t return anything, running capacity_status
doesn’t return true or false.
yes, a function has its own scope. Omitting the return statement looses the “False” or “True” values in each function.
Placing return makes sure the calling code receives the return values.
Thank you
Thanks …