WorksheetsModule 3 [Function & Arrays]
Total questions: 50
Worksheet time: 25mins
Output ?
5
10
15
Error
Output ?
10
20
Undefined
Error
Output ?
[2,4,6]
[4,4,4]
[4,4,3]
Error
Output ?
[2]
[2,3]
[1,2]
Error
Output ?
5
10
15
error
Output ?
10
undefined
no value
Error
What happens here ?
[2,4,6]
[1,2,3]
undefined
(forEach returns undefined)
Error
Output ?
[2,3,4]
[1,2,3]
undefined
Error
[10, 15]
[20, 25]
25
error
Extremely tricky closure output:
0 1 2
3 3 3
undefined undefined undefined
Error
Deep destructuring trap:
30
40
undefined
Error
Changing reference in recursion:
[6,4,2], [1,2,3]
[6,4,2], []
[1,2,3], []
Error
JSON parse/stringify trap:
{"a":1,"b":null}
{"a":1}
{"a":1,"b":undefined,"c":{}}
Error
THIS binding confusion:
20
undefined
Error
Null
Arrow vs normal function THIS trap:
50
undefined
this.x
Error
Mutating nested objects with spread:
1
100
undefined
Error
Reduce with no initial value:
5
undefined
Error
NaN
typeof + null weird behavior
null
object
undefined
Error
Map with key reference comparison
hello
undefined
{}
Error
Function + Default Parameter Trap
5
10
15
Error
Arrow Function THIS Binding
10
undefined
Error
null
Optional Parameter + Falsy Trap
20
10
0
Error
Rest Parameters + Reduce
5
0
undefined
Error
Recursive Function Mutation
[3,6,9], []
[9,6,3], []
[9,6,3], [1,2,3]
Error
forEach Return Trap
[2,4,6]
undefined
[1,2,3]
Error
Complex Filter + Map
[4,12]
[4,8]
[8,16]
[4,8,12,16]
Nested Object Shallow Copy
1
100
undefined
Error
JSON.stringify Drop Values
{"a":1,"b":null}
{"a":1}
{"a":1,"b":undefined,"c":"function"}
{}
Array Reduce Without Initial
-40
0
-20
-10
Complex Destructuring
20
30
undefined
Error
Map with Undefined Callback
[1,2,3]
[undefined,2,3]
[2,3]
Error
JSON.parse Nested
10
"10"
Undefined
Error
Optional Chaining
5
no
undefined
error
Hoisting + Function Overwrite
1
2
error
Undefined
Arrow Function + This Binding
50
20
undefined
error
Default Parameter + Undefined Trap
5
10
20
15
Optional Parameter + Falsy Condition
20
10
0
Error
Rest Parameter + Reduce Edge Case
0
7
undefined
Error
Recursive Function Mutates Original Array
[2,4,6], [1,2,3]
[6,4,2], []
[6,4,2], [1,2,3]
Error
forEach Return Behavior
[2,4,6]
undefined
[]
Error
Complex Filter + Map Sequence
[5,15]
[5,10,15,20]
[1,3]
[10,20]
JSON.stringify Removes Keys
{"a":1}
{"a":1,"b":null}
{"a":1,"c":"function"}
Error
Destructuring With Nested Object
5
10
50
Error
Reduce Without Initial Value
2
1
4
0.5
Map Logic With Missing Return
[1,2,3]
[undefined,2,3]
[2,3]
Error
Spread Operator Is Shallow
10
200
undefined
Error
Optional Chaining + Nullish Coalescing
7
undefined
no value
Error
Function Overwriting Due to Hoisting
A
B
Error
undefined
Functions + Default Parameter + Undefined Trap
5 + 20 + 10 = 35
5 + 20 + 5 = 30
5 + undefined + undefined
Error
map + filter + mutation + side effect trap
[2,4,6,8], [6,12]
[2,4,6,8], [6,14]
[2,4,6,8], [8,14]
Error
