js if else
If - Else Statements
if (condition) {
// what to do if condition is met
} else {
// what to do if condition is not met
}
if (condition1) {
// code to be executed if condition1 is true
} else if (condition2) {
// code to be executed if the condition1 is false and condition2 is true
} else {
// code to be executed if the condition1 is false and condition2 is false
}var age=20;
if (age < 18) {
console.log("underage");
} else {
console.log("let em in!");
}if (condition1) {
// block of code to be executed if condition1 is true
} else if (condition2) {
// block of code to be executed if the condition1 is false and condition2 is true
} else {
// block of code to be executed if the condition1 is false and condition2 is false
}if (5 < 10) {
console.log("5 is less than 10");
} else {
console.log("5 is now bigger than 10")
}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")
Also in JavaScript:
- chrome extension inject html
- response()->json(['data' => $allCheaters]) not getting back
- remove node_modules folder mac
- react tooltip on disabled button
- jquery get data attribute of selected option
- addclass removeclass jquery
- javascript get all characters before a certain one
- add javascript
- fetch response json or text
- how to access child img src in jquery
- foreach and replace item based on condition
- resizing div js
- filter in react native
- how to convert a queryset into json string
- arrow keys function javascript
- how to find all permutations of an array with javascript
- round down js
- action checkbox selected vue js
- javascript detect page
- react convert excel to json
- jquery select box change event
- What is the correct JavaScript syntax for opening a new window called "w2" ?
- jquery modal on show + target button
- get the name of month without using hard coded arrays in javascript