1If - Else Statements
2if (condition) {
3// what to do if condition is met
4} else {
5// what to do if condition is not met
6}
7
1if (expression) {
2 Statement(s) to be executed if expression is true
3} else {
4 Statement(s) to be executed if expression is false
5}
6
1var age=20;
2if (age < 18) {
3 console.log("underage");
4} else {
5 console.log("let em in!");
6}
1var price = 500;
2var money = 100;
3
4if (price > money) {
5 console.log("Not Enough")
6} else {
7 console.log("Can Buy")
8}