JavaScript/Reserved words/if
< JavaScript | Reserved words
The if keyword
[edit | edit source]The if keyword stars a loop that executes until the condition is met.
Examples
[edit | edit source]![](http://upload.wikimedia.org/wikipedia/commons/thumb/d/d6/Crystal_Clear_action_apply.png/20px-Crystal_Clear_action_apply.png)
var result = 1;
if (result%2 == 0) {
console.log(result + " is an odd number");
} else {
console.log(result + " is an even number");
}
returns the following:
1 is an even number