Skip to content

Instantly share code, notes, and snippets.

View heinthanth's full-sized avatar
COOKING

Hein Thant heinthanth

COOKING
View GitHub Profile
@heinthanth
heinthanth / table-typical.html
Created August 31, 2019 11:26
table-typical
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Typical Table Example</title>
</head>
<body>
<table>
<thead>
<tr>
@heinthanth
heinthanth / description-list.html
Created August 31, 2019 12:13
Description List
<!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>
@heinthanth
heinthanth / if-elseif-else.js
Created September 1, 2019 03:20
if-elseif-else
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
}
@heinthanth
heinthanth / if-else-with-prompt.js
Created September 1, 2019 03:23
If else with prompt
var x = prompt("Are You Sure to Exit");
if(x) {
// someghig if user click OK / Yes
} else {
// something if user cancle
}
// in other form
@heinthanth
heinthanth / switch.js
Created September 1, 2019 03:26
Switch
var x = 2;
switch(x) {
case 1:
// do something
break;
case 2:
// will execute since x = 2
break;
default:
@heinthanth
heinthanth / switch-with-multiple-conditions.js
Created September 1, 2019 03:31
Switch with Multiple Condition
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;
@heinthanth
heinthanth / while-loop.js
Created September 1, 2019 03:34
While Loop
while(condition) {
// will continue to execute until conditon become false
}
@heinthanth
heinthanth / for-loop.js
Last active September 1, 2019 03:38
For Loop
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;
@heinthanth
heinthanth / do-while.js
Created September 1, 2019 03:43
Do While
var x = 3;
do {
// will execute once although condition is x != 3
} while(x != 3);
@heinthanth
heinthanth / for-in.js
Created September 1, 2019 03:49
For-In
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
}