-
Notifications
You must be signed in to change notification settings - Fork 12
/
console-1690260716310.log
92 lines (90 loc) · 1.43 KB
/
console-1690260716310.log
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
var emp = {id:1001, name:'Ram'};
undefined
emp.id;
1001
emp['id'];
1001
var dhoni = {name:'MS Dhoni', age:40, 50:51,100:20};
undefined
dhoni.name;
'MS Dhoni'
dhoni.50;
VM216:1 Uncaught SyntaxError: Unexpected number
dhoni[50];
51
dhoni['name'];
'MS Dhoni'
dhoni['full address'] = 'Delhi';
'Delhi'
dhoni;
{50: 51, 100: 20, name: 'MS Dhoni', age: 40, full address: 'Delhi'}
dhoni.full address;
VM443:1 Uncaught SyntaxError: Unexpected identifier 'address'
dhoni['full address'];
'Delhi'
var x = 'age';
undefined
dhoni.x;
undefined
dhoni;
{50: 51, 100: 20, name: 'MS Dhoni', age: 40, full address: 'Delhi'}
dhoni [x];
40
for(var key in dhoni){
console.log(key);
}
VM632:2 50
VM632:2 100
VM632:2 name
VM632:2 age
VM632:2 full address
undefined
for(var key in dhoni){
console.log(key, dhoni[key]);
}
VM685:2 50 51
VM685:2 100 20
VM685:2 name MS Dhoni
VM685:2 age 40
VM685:2 full address Delhi
undefined
var emp = {id:1001, name:'Amit';}
VM714:1 Uncaught SyntaxError: Unexpected token ';'
var emp = {id:1001, name:'Amit'};
undefined
typeof emp;
'object'
emp instanceof Object;
true
typeof Object;
'function'
var o = {};
undefined
var t = new Object();
undefined
o;
{}
t;
{}
var arr =[10,20,30];
undefined
arr instanceof Array;
true
arr instanceof Object;
true
var t = [10,20];
undefined
var tt = new Array(10);
undefined
tt;
(10) [empty × 10]
t;
(2) [10, 20]
typeof tt;
'object'
typeof t;
'object'
tt instanceof Array;
true
t instanceof Array;
true