-
Notifications
You must be signed in to change notification settings - Fork 12
/
console-1690346930969.log
189 lines (189 loc) · 3.18 KB
/
console-1690346930969.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
var arr = [10,20,30,40];
undefined
var arr2 = [100,200,300];
undefined
var arr3 = [arr, arr2];
undefined
arr3;
(2) [Array(4), Array(3)]0: (4) [10, 20, 30, 40]1: (3) [100, 200, 300]length: 2[[Prototype]]: Array(0)
arr3[0][0];
10
var arr4 = [...arr, ...arr2];
undefined
arr4;
(7) [10, 20, 30, 40, 100, 200, 300]
var emp = {id:1001, name:'Ram'};
undefined
var dept = {dname:'IT' , id:1002, };
undefined
var merge = {emp, dept};
undefined
merge.emp;
{id: 1001, name: 'Ram'}
merge.emp.name;
'Ram'
merge.dept.dname;
'IT'
var merge2 = {...emp, ...dept};
undefined
merge2;
{id: 1002, name: 'Ram', dname: 'IT'}
var x = [10,20,30];
undefined
var y = x;
undefined
y[0] = 1111;
1111
y;
(3) [1111, 20, 30]
x;
(3) [1111, 20, 30]
var z = [...x];
undefined
z;
(3) [1111, 20, 30]
x;
(3) [1111, 20, 30]
z[0] = 3333;
3333
z;
(3) [3333, 20, 30]
x;
(3) [1111, 20, 30]
function show(...arg){
console.log(arg);
}
undefined
show(10,20,30,40);
VM994:2 (4) [10, 20, 30, 40]
undefined
show();
VM994:2 []
undefined
show(10,20);
VM994:2 (2) [10, 20]
undefined
var q =100;
undefined
var tt = 100; // Place at Top (Window)
function disp(){
// var z1;
console.log(z1); // undefined
if(10>2){
var z1 = 100;
}
console.log(z1); // 100
var z1 =200;
var z1 = 300;
console.log(z1); // 300
}
undefined
show();
VM994:2 []
undefined
disp();
VM1364:4 undefined
VM1364:8 100
VM1364:11 300
undefined
tt;
100
z1;
VM1424:1 Uncaught ReferenceError: z1 is not defined
at <anonymous>:1:1
(anonymous) @ VM1424:1
window.tt;
100
tt; // window.tt;
100
function output(){
for(let i = 1; i<=5; i++){
console.log(i);
}
console.log(i);
}
undefined
output();
VM1588:3 1
VM1588:3 2
VM1588:3 3
VM1588:3 4
VM1588:3 5
VM1588:5 Uncaught ReferenceError: i is not defined
at output (<anonymous>:5:17)
at <anonymous>:1:1
output @ VM1588:5
(anonymous) @ VM1608:1
function output(){
for(let i = 1; i<=5; i++){
console.log(i);
}
let i = 1000;
console.log(i);
}
undefined
output();
VM1625:3 1
VM1625:3 2
VM1625:3 3
VM1625:3 4
VM1625:3 5
VM1625:6 1000
undefined
function output(){
let i = 2000;
for(let i = 1; i<=5; i++){
console.log(i);
}
let i = 1000;
console.log(i);
}
VM1665:6 Uncaught SyntaxError: Identifier 'i' has already been declared
function output(){
console.log(i);
let i =1000;
console.log(i);
}
undefined
output();
VM1724:2 Uncaught ReferenceError: Cannot access 'i' before initialization
at output (<anonymous>:2:17)
at <anonymous>:1:1
output @ VM1724:2
(anonymous) @ VM1771:1
let p = 1000;
undefined
window.p;
undefined
function total(){
g = 1000;
}
undefined
total();
undefined
g;
1000
const MAX = 100;
undefined
MAX++;
VM2001:1 Uncaught TypeError: Assignment to constant variable.
at <anonymous>:1:4
(anonymous) @ VM2001:1
MAX = 200;
VM2022:1 Uncaught TypeError: Assignment to constant variable.
at <anonymous>:1:5
(anonymous) @ VM2022:1
const PRODUCTS = [10,20,30,40];
undefined
PRODUCTS.push(10000);
5
PRODUCTS;
(5) [10, 20, 30, 40, 10000]
PRODUCTS[0] = 3333;
3333
PRODUCTS;
(5) [3333, 20, 30, 40, 10000]
PRODUCTS = [1000,2000,300];
VM2311:1 Uncaught TypeError: Assignment to constant variable.
at <anonymous>:1:10
(anonymous) @ VM2311:1