-
-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathdataTypes.js
More file actions
35 lines (26 loc) · 785 Bytes
/
dataTypes.js
File metadata and controls
35 lines (26 loc) · 785 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
//String datatype
let string = "Kaiwalya";
//Number datatype
let number = 7;
//Boolean datatype
let bool = true;
//Array data structure
let array = [1, 2, 3, 4, 5, "hi", "welcome"]
//Objecting the datatype
let object = {
keyname:"This is object.keyname",
"key-name":"This is obj[key-name (key-name in parenthesis)]"
};
//--------Accessing all the data------
//String number and boolean are accessed like this
console.log(string);
console.log(number);
console.log(bool);
//Arrays are accessed like this
console.log(array[2]);
console.log(array[6]);
//Object data is accessed like this
//This is if the keyname is simple
console.log(object.keyname);
//This is if the keyname has special chararcters like at this time it has " - "
console.log(object["key-name"]);