-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataTypes.html
More file actions
27 lines (25 loc) · 839 Bytes
/
DataTypes.html
File metadata and controls
27 lines (25 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!DOCTYPE html>
<html lang="en">
<head>
<title>Tipe Data Javascript</title>
</head>
<body>
<h2>Tipe Data Variabel</h2>
<p id="typeLength"></p>
<p id="typeLastname"></p>
<p id="typeObject"></p>
<script>
//Inisiasi variabel
let length = 16; //Number
let lastname = "Johnson"; //String
const x = {
firstName: "John",
lastName: "Doe"
}; //Object
//Mengetahui tipe data menggunakan typeof
document.getElementById(`typeLength`).innerHTML = `Tipe data dari length adalah: ${typeof length}`;
document.getElementById(`typeLastname`).innerHTML = `Tipe data dari lastname adalah: ${typeof lastname}`;
document.getElementById(`typeObject`).innerHTML = `Tipe data dari x adalah: ${typeof x}`;
</script>
</body>
</html>