if (typeof myVar === 'string') { /* code */ };

if string javascript

If - Else Statements if (condition) { // what to do if condition is met } else { // what to do if condition is not met }

js if else

if (time < 10) { greeting = "Good morning"; } else if (time < 20) { greeting = "Good day"; } else { greeting = "Good evening"; }

if else javascript

if (condition) { //what is done }

if syntax javascript

var i; for (i = 0; i < 10 ; i++) { //do something }

for loop javascript

if (expression) { Statement(s) to be executed if expression is true } else { Statement(s) to be executed if expression is false }

using if statements in javascript