how to use if else statement in javascript

JavaScript
If - Else Statements
if (condition) {
// what to do if condition is met
} else {
// what to do if condition is not met
}
var condition = true; // An example condition for true/false conditions

if (condition == true) {
	console.log('condition is true');  
} else {
	console.log('condition is not true');  
} // Console will output 'condition is true'if( name = 'george washington'):
	print("You have the same name as the first president of the United States")
    // python 
else:
	print("You do not have the same name as George Washington")
Source

Also in JavaScript: