The if/else statement executes a block of code if a specified condition is true. If the condition is false, another block of code can be executed. The if/else statement is a part of JavaScript’s “Conditional” Statements, which are used to perform different actions based on different conditions. The general form of if-else is as follows: if (test-expression) { True block of statements } Else { False block of statements } Statements; n this type of a construct, if the value of test-expression is true, then the true block of statements will be executed. The isNaN() function determines whether a value is NaN when converted to a number Because coercion inside the isNaN() function can be surprising, one may alternatively want to use Number.isNaN().
Reader Interactions
Comments
Leave a Reply
You must be logged in to post a comment.
Catrina Schlossberg says
Hi Lisbeth,
I like the image you chose to help explain the isNaN function. That one in particular confused me a bit and it helps me understand it better.