1if (time < 10) {
2 greeting = "Good morning";
3} else if (time < 20) {
4 greeting = "Good day";
5} else {
6 greeting = "Good evening";
7}
1if (condition1) {
2 // block of code to be executed if condition1 is true
3 }
4else if (condition2) {
5 // block of code to be executed if the condition1 is false and
6 // condition2 is true
7} else {
8 // block of code to be executed if the condition1 is false and
9 // condition2 is false
10 }
1var age=20;
2if (age < 18) {
3 console.log("underage");
4} else {
5 console.log("let em in!");
6}
1// a loop is where you say i = 5 and if i < 6 {
2 // print("hdyugvryvg");
3// it means i = 5 and 6 is greater than 5 so it should print out hdyugvryvg 5 times
4//}
5
6// example
7
8for (let i = 0; i < 10000; i++) {
9 console.log('huduiduin 100000 times');
10}
11
12
13
14// dont try this put a lower number this nearly crashed my browser
1if ((age >= 14) && (age < 19)) { // logical condition
2status = "Eligible."; // executed if condition is true
3} else { // else block is optional
4status = "Not eligible."; // executed if condition is false
5}