We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 495ce5e commit 417ab20Copy full SHA for 417ab20
1 file changed
js/tricks.md
@@ -3,12 +3,13 @@
3
## `Object.assign` is also useful on arrays
4
5
```
6
-const initialScores = [0, 0, 0];
7
-// player a, player b, total games
8
-const scores = [5, 2, 7];
+const initialScores = [0, 0];
+// player a, player b, total games played
+const state = [5, 2, 7];
9
10
-// reset scores
11
-Object.assign(scores, initialScores);
+// reset scores only
+Object.assign(state , initialScores);
12
+// state = [0, 0, 7];
13
14
15
## `{}` can be used to create local scopes anywhere
0 commit comments