Edit 3 years later: I simply forgot to call the function.
So i have this code:
function xy () {
return true
}
Can I now read the return in an if statement? I tried this, but it didn't work.
if (xy == true){
//stuff
}
Edit 3 years later: I simply forgot to call the function.
So i have this code:
function xy () {
return true
}
Can I now read the return in an if statement? I tried this, but it didn't work.
if (xy == true){
//stuff
}
You need to call your method to retrieve the result.
if(xy() === true){
//stuff
}
You need to call the function:
if (xy() == true){
Writing xy
just references the function and the function object is not equal to true