-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscript16.js
73 lines (56 loc) · 1.16 KB
/
script16.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
let info = ["chinmay","deshpande",7709192441,34,55]
console.log(info)
// retrive
console.log(info[0])
// update
info[0] = "snehal"
console.log(info)
// add
info.push("pune")
info.unshift("Mr")
// delete
info.pop()
info.shift()
// program 2
info2 = ["amol",'rao','pune',23,45]
info2 = {
//"key":value
//"property:value"
firstName:"amol",
lastName:"rao",
city:"pune",
age:23,
rollNo:45
}
// object stores the value by index???
//console.log(info2[0])
// retrive
// dot notation and bracket notation
console.log(info2.firstName)
console.log(info2['firstName'])
// update
// dot notation and bracket notation
info2.firstName = "snehal"
info2['age'] = 34
console.log(info2)
// add
// dot notation and bracket notation
info2.language = "marathi"
info2['country'] = "india"
console.log(info2)
// delete
// dot notation and bracket notation
delete info2.firstName
delete info2['firstName']
let vehicle ={
color:"red",
type:"sedane"
}
// console.log(vehicle.color)
// vehicle.color = "green"
// vehicle.regNo = 124
// delete vehicle.color
console.log(vehicle['color'])
vehicle['color'] = "red"
vehicle['regNo'] = 123
delete vehicle['type']