This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Typical Table Example</title> | |
| </head> | |
| <body> | |
| <table> | |
| <thead> | |
| <tr> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Description List</title> | |
| </head> | |
| <body> | |
| <dl> | |
| <dt>Windows</dt> | |
| <dd>An OS based on Disk Operating System (DOS)</dd> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (condition1) { | |
| // will execute if condition1 is true | |
| } else if (condition2) { | |
| // will execute if condition1 is false and condition is true | |
| } else { | |
| // will execute if both condition1 and condition2 are false | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var x = prompt("Are You Sure to Exit"); | |
| if(x) { | |
| // someghig if user click OK / Yes | |
| } else { | |
| // something if user cancle | |
| } | |
| // in other form |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var x = 2; | |
| switch(x) { | |
| case 1: | |
| // do something | |
| break; | |
| case 2: | |
| // will execute since x = 2 | |
| break; | |
| default: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var x = "bar"; | |
| switch(x) { | |
| case "foo": | |
| case "bar": | |
| // will execute if x is either "foo" or "bar" | |
| break; | |
| case "baz": | |
| // will execute if x is neither "foo" nor "bar" | |
| break; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| while(condition) { | |
| // will continue to execute until conditon become false | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for(var i = 0; i < 5; i++) { | |
| /* | |
| will execute 5 times | |
| since i < 5 is true for 5 times | |
| */ | |
| } | |
| // if initializer is already initialized, no need to initialize; | |
| var j = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var x = 3; | |
| do { | |
| // will execute once although condition is x != 3 | |
| } while(x != 3); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var x = [4, 5, 6, 7, 8]; | |
| for(var i in x) { | |
| console.log(i); | |
| // will log 4, 5, 6, 7, 8 in each time since i = x[i] in each time | |
| } |