Last active
April 20, 2022 04:58
-
-
Save anibal21/ee76096a8febf0e6e9a61b5511f0f2d3 to your computer and use it in GitHub Desktop.
JavaScript interpreter Problems
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This validation is correct, because is not undefined neither zero | |
if(42){ | |
// Here we have a comparison without types (===) so, JS sees both as equals | |
if(42 == "42"){ | |
// Correct | |
if(true){ | |
// This have no sense, because the callstack see the first item that is an integer, and can't compare | |
// the boolean as a number | |
if(42 == true){ | |
console.log("continue") | |
} else { | |
// This is the answer | |
console.log("42 is not equal to true") | |
} | |
} else { | |
console.log("true alone is not a conditional") | |
} | |
} else { | |
console.log("the parts are not equal") | |
} | |
}else { | |
console.log("It wasn't 42") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment