0
Where's my mistake?
Can someone tell me where am I making a mistake? Because even when I input «yes» in the prompt, I get the «You might be okay» response 😂 https://code.sololearn.com/Wh3X8VQulWAA/?ref=app
2 odpowiedzi
+ 1
https://code.sololearn.com/WWolDAsGua0P/?ref=app
Must be a good code!
When you call function migraine, it doesn't return the value answered (yes or no).
Example :
function add(x, y){
return x+y;
}
var number=add(10, 10);
//number=20
0
prompt return the input like string but you dont use it
in the if statement, you compare migraine (thats is a function) with yes (thats is a string) and because a string is (almost) never equals to a string, it will be executed the code in else
For resolve :
1) migraine have to retun the prompt input
2) you have to compare the RESULT of call migrate with the string like:
if( migraine()==yes)....