function isGreaterThan (numberOne, numberTwo){
if(numberOne > numberTwo){
return true;
} else {
return false;
}
}
isGreaterThan(5, 1);
console.log(isGreaterThan());
This returns false in the console even if I change 1 and 5 and 5 and 1. The lesson says I passed but I’d rather not move on until I know why it won’t change to true.
Edit: Asked a co-worker and the reason is because the you’re not calling an actual function since you’re comparing null to null. You have to store the function in another variable like
var result = isGreaterThan(1,5);
console.log(result);
And that will get you the correct results.