-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnonPrimitveDataType.js
More file actions
70 lines (53 loc) Β· 1.2 KB
/
Copy pathnonPrimitveDataType.js
File metadata and controls
70 lines (53 loc) Β· 1.2 KB
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
var a = [10,20,30,40,50,[60,70,80]]
console.log(a)
a.push(60) // for adding the element in array
console.log(a)
a.pop() // for removing the last element
console.log(a)
console.log("The length of arrary a:",a.length)
for(let b in a){
console.log(a[b])
}
var b = ["Adarsh",2026,2025.09,true]
for(let a in b){
console.log(b[a])
}
//higher order function
a.forEach(function(elem){
console.log("Hello",elem)
})
//--------------------------------
//Object
var team = {
name : "RCB",
captian : "Rajat Patidar",
trophy : 2,
fighter : true,
fanbase : 1000000000000000,
slogan:function(){
console.log("E sala 3 cup namdu")
return 18
},
championYear1 : [2025,2026],
obj:{orangeCap:"Virat Kohli",purpleCap:"Bhuvi"}
}
console.log(team)
for(let details in team){
console.log(`${details} -> ${team[details]}`)
}
console.log(team.slogan())
console.log(team["obj"]["orangeCap"])
console.log(team.obj.purpleCap)
//Important thing--------------------
var a = [
{user:"Pritam",Age:20},
{user:"Rohit",Age:21},
function raj(){
console.log("Adarsh")
return 18
}
]
console.log(a)
console.log(a[1])
console.log(a[1].user)
console.log(a[2]())