forked from uciharis/materi_masEko
-
Notifications
You must be signed in to change notification settings - Fork 0
/
19_typeof.js
executable file
·42 lines (33 loc) · 947 Bytes
/
19_typeof.js
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//operator typeof digunakan utk melihat tipe data suatu variabel
//karna js ini dinamik, kita perlu mengecek tipe datanya
//tipe---------- hasil typeof
//undefined------ "undefined"
//null------ "object"
//boolean------ "boolean"
//number------ "number"
//BigInt------ "bigint"
//String------ "string"
//Symbol------ "symbol"
//Function------ "function"
//lainnya------ "object"
let data; //undefined
const typeData= typeof data;
console.log(typeData);
let data21={}; //object
const typeData21=typeof(data21);
console.log(typeData21);
let data31=[]; //object
const typeData31=typeof(data31);
console.log(typeData31);
let data1="eko"; //string
const typeData1= typeof data1;
console.log(typeData1);
let data2=123; //number
const typeData2=typeof(data2);
console.log(typeData2);
let data3=20e10; //number
const typeData3=typeof(data3);
console.log(typeData3);
let data4=true; //boolean
const typeData4=typeof(data4);
console.log(typeData4);