If and else statements allow you to run code based on whether a condition is true or false. Basically this allows code to run the specified statement if the condition of the statement is true and it allows the code to run the specified statement if the condition is false. This is the basic synatx of If/else statements. IsNaN is a function used to see whether or not the given value is valid or not. IsNaN is a global method which means it is available everywhere in your code. We can evaluate && as both operands are true then the result is true, if one or more is false then the result is false. We can evaluate || as needing both conditions to be false in order for the result to be false. In an if statement if the condition of the statement is true then the code runs. This is different from Else-if statements because code will run either way if the condition is true or false.
Leave a Reply
You must be logged in to post a comment.