-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobj.js
More file actions
45 lines (42 loc) · 891 Bytes
/
Copy pathobj.js
File metadata and controls
45 lines (42 loc) · 891 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
//Objects
const myObjects = {
name: "Assumpta",
school: "UNN",
Level: "300",
dept: "Comp/Stat",
email: "example@gmail.com",
address: "hilltop",
topic: "objects",
hobby: "watching movies",
cgpa: "God abeg",
talent: "sleeping",
}
//to delete 2 elements
delete myObjects.email;
delete myObjects.address;
//to add 3 elements
myObjects.state = "Enugu";
myObjects.color = "blue";
myObjects.country = "London";
//print
console.log(myObjects);
//Arrays
items = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100];
//delete 2 numbers
items.pop();
items.pop();
//change to animals
items[0] = "cat";
items[1] = "dog";
items[2] = "goat";
items[3] = "cow";
items[4] = "fish";
items[5] = "chicken";
console.log(items);
//conditions
let age = 20;
if (age >= 18) {
console.log("You're an adult");
} else {
console.log("Your're not an adult");
}