Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit eb69d21

Browse files
Learn JavaScript Basic
0 parents commit eb69d21

27 files changed

+957
-0
lines changed

‎JavaScript-Basic/Array.html

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8+
<title>Learn Array</title>
9+
</head>
10+
11+
<body>
12+
<script>
13+
let arrayKosong = [];
14+
15+
// addication array / menambhakan array
16+
arrayKosong.push("Adrina");
17+
arrayKosong.push("Iwan", "Rona");
18+
arrayKosong.push("Lulu", "Meisa");
19+
20+
// get length array / mendaptkan panjang array
21+
arrayKosong.length;
22+
23+
// get array
24+
console.info(arrayKosong[2]); //Rona
25+
26+
// put array
27+
arrayKosong[0] = "Adrian"; // Adrian
28+
29+
// delete array
30+
delete arrayKosong[3];
31+
32+
console.table(arrayKosong)
33+
</script>
34+
</body>
35+
36+
</html>

‎JavaScript-Basic/Boolean.html

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8+
<title>Learn Boolean</title>
9+
</head>
10+
11+
<body>
12+
<script>
13+
document.writeln(true);
14+
document.writeln(false);
15+
16+
// Operator non Boolean
17+
console.info("Hello" || ""); //Hello
18+
console.info("" || []); //[]
19+
console.info("0" || "Nol"); //0
20+
console.info(0 || "Nol"); //Nol
21+
console.info(null || "Null"); //"Null"
22+
console.info(undefined || "Undefined"); //"Undefined"
23+
console.info(0 || false); //false
24+
25+
console.info("Hello" && ""); //""
26+
console.info("" && []); //""
27+
console.info("0" && "Nol"); //"Nol"
28+
console.info(0 && "Nol"); //0
29+
console.info(null && "Null"); //null
30+
console.info(undefined && "Undefined"); //undefined
31+
console.info(0 && false); //0
32+
33+
34+
</script>
35+
</body>
36+
37+
</html>

‎JavaScript-Basic/Closure.html

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8+
<title>Learn Closure</title>
9+
</head>
10+
11+
<body>
12+
<h1>Apa itu Closure :</h1>
13+
<p> Closure adalah kombinasi function dan bundel reference ke data di sekitarnya</p>
14+
15+
<script>
16+
function createAdder(value) {
17+
const owner = "Rina";
18+
19+
function add(params) {
20+
console.info(owner);
21+
return value * params;
22+
}
23+
24+
return add;
25+
}
26+
27+
const addTwo = createAdder(2);
28+
console.info(addTwo(10));
29+
</script>
30+
31+
</body>
32+
33+
</html>

‎JavaScript-Basic/Console.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8+
<title>Learn Console</title>
9+
</head>
10+
11+
<body>
12+
<script>
13+
console.info("Hello World") //Untuk memberikan informasi
14+
console.warn("This is Warning") //Untuk memberikan Peringata
15+
console.error("This is Error") //Untuk memberikan Error
16+
</script>
17+
</body>
18+
19+
</html>

‎JavaScript-Basic/Convert.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8+
<title>Learn OCnvert</title>
9+
</head>
10+
11+
<body>
12+
<script>
13+
const toInt1 = parseInt("100.12");
14+
const toFloat1 = parseFloat("100.12");
15+
const toString1 = 100;
16+
document.writeln(toInt1);
17+
document.writeln(toFloat1);
18+
document.writeln(toString1.toString());
19+
</script>
20+
21+
</body>
22+
23+
</html>

‎JavaScript-Basic/Do-While-Loop.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8+
<title>Do while</title>
9+
</head>
10+
11+
<body>
12+
<script>
13+
let varLoop = 1;
14+
do {
15+
document.writeln(`${varLoop}`);
16+
varLoop++;
17+
} while (varLoop < 1) {
18+
19+
}
20+
</script>
21+
</body>
22+
23+
</html>

‎JavaScript-Basic/Flasy.html

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8+
<title>Flasy</title>
9+
</head>
10+
11+
<body>
12+
<script>
13+
// Data Falsy, semua data value di anggap false
14+
/**
15+
false : false
16+
0, -0 : false
17+
"", '', `` : false
18+
null : false
19+
undefined : false
20+
NaN : false
21+
**/
22+
// Truthy adalah kebalikan falsy yaitu semua data value dianggap true
23+
24+
const data = "";
25+
26+
if (data) {
27+
document.writeln("data: True");
28+
} else {
29+
document.writeln("data: False");
30+
}
31+
</script>
32+
</body>
33+
34+
</html>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8+
<title>For in <Object></Object></title>
9+
</head>
10+
11+
<body>
12+
<script>
13+
const person = {
14+
firstName: "Adrian",
15+
MiddleName: "Miftahul",
16+
lastName: "Haq",
17+
}
18+
19+
for (const property in person) {
20+
document.writeln(`<h1>${property} : ${person[property]}</h1>`);
21+
}
22+
23+
24+
const name = ["Adrian", "Miftahul", "Haq"];
25+
26+
for (const index in name) {
27+
document.writeln(`<h1>${index} : ${name[index]}</h1>`);
28+
}
29+
</script>
30+
</body>
31+
32+
</html>

‎JavaScript-Basic/For-Loop.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8+
<title>Learn For Loop</title>
9+
</head>
10+
11+
<body>
12+
<script>
13+
/**
14+
* for (init stat; codition; post stat){
15+
* Block loop
16+
* }
17+
* **/
18+
19+
for (let varLoop = 1; varLoop <= 7; varLoop++) {
20+
document.writeln(`${varLoop}`);
21+
}
22+
</script>
23+
</body>
24+
25+
</html>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /