-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdataTypes.js
More file actions
47 lines (37 loc) · 770 Bytes
/
dataTypes.js
File metadata and controls
47 lines (37 loc) · 770 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Primitive Data Type
// String
const hisName = "Jamil";
const herName = "Najwa";
// Number
const hisAge = 20;
const herAge = 24;
const phi = 3.14;
// Boolean
const isStudent = true;
const isMentor = false;
// Null
let user = null;
user = "Jamil";
// Undefined
let data;
// Compound Data Type
// Object -> Key-value pair (Entity)
const employee = {
name: "Reza",
job: "Assistant"
};
const book = {
title: "Harry Potter",
author: "JK Rowling"
}
const company = {
name: "Devscale Indonesia",
address: "Surabaya",
totalEmployees: 1000
}
// console.log(company.name);
// Array -> Sequence of Data
const fruits = ["Apple", "Banana", "Durian"]
const coordinate = [10, 20, 30]
const myFavoritNumbers = [1, 4, 8, 12]
console.log(fruits[1])