Skip to content

Commit 495ce5e

Browse files
author
Cyril Walle
committed
formatting
1 parent 992e5e3 commit 495ce5e

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

js/tricks.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# JS tricks
22

3-
`Object.assign` is useful on arrays.
3+
## `Object.assign` is also useful on arrays
44

55
```
66
const initialScores = [0, 0, 0];
@@ -11,7 +11,7 @@ const scores = [5, 2, 7];
1111
Object.assign(scores, initialScores);
1212
```
1313

14-
`{}` can be used to create local scopes anywhere
14+
## `{}` can be used to create local scopes anywhere
1515

1616
```
1717
const minMax = function (numbers) {
@@ -33,7 +33,7 @@ const minMax = function (numbers) {
3333
```
3434

3535

36-
Array destructuring syntax can be used to swap variables;
36+
## Array destructuring syntax can be used to swap variables
3737

3838
```
3939
let a = 5;
@@ -42,14 +42,14 @@ let b = 2;
4242
```
4343

4444

45-
Remove duplicates from an array
45+
## `new Set` to remove duplicates from an array
4646

4747
```
4848
let a = [5, 4, 4, 4, 3];
4949
a = [...(new Set(a))];
5050
```
5151

52-
Object.seal and Object.freeze to ensure that an external object does not exceed an Interface
52+
## `Object.seal` to ensure that a passed object does not exceed an interface
5353

5454
```
5555
const requestInterface = {
@@ -78,7 +78,7 @@ handleRequest({
7878
});
7979
```
8080

81-
default assignement syntax to log for required parameters
81+
## Default assignement syntax to log for required parameters
8282

8383
```
8484
const required = function () {
@@ -94,7 +94,7 @@ const slowVector3 = function (vector3 = required()) {
9494
slowVector3() --> Error: required parameter missing
9595
```
9696

97-
It works really well with destructuring too
97+
## Required parameters + destructuring
9898

9999

100100
```

0 commit comments

Comments
 (0)