File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Exercises
2
+
3
+ ## Hoisting
4
+
5
+ 1 . Implement function containing local variable with hoisting.
6
+ 2 . Commit example to github.
7
+ 3 . Use eslint to find this problem and --fix flag to remove it.
8
+ 4 . Fix example manually and commit it to github.
9
+
10
+ ## Scalar value vs Reference
11
+
12
+ Prepare two implementations of ` inc ` function:
13
+ 1 . First with signature ` inc(n: number): number ` ,
14
+ call example: ` let a = 5; const b = inc(a); console.dir({ a, b }); `
15
+ 2 . Second with signature ` inc(num: Num) ` where ` Num ` is object with field ` n ` ,
16
+ so function will change field of the object passed by reference,
17
+ call example: ` let obj = { n: 5} ; inc(obj); console.dir(obj); `
18
+
19
+ ## Types
20
+
21
+ 1 . Prepare array with values of different type.
22
+ 2 . Prepare collection (object) with type names as keys and ` 0 ` as values,
23
+ example: ` { number: 0, string: 0 } ` and so on for all types.
24
+ 3 . Iterate array with ` for..of ` loop and increment occurrence counter there
25
+ to get collection of types occurrences count for all types in array.
26
+ 4 . Modify this example: remove all keys from initial collection literal and
27
+ add all keys dynamically from the loop.
You can’t perform that action at this time.
0 commit comments