mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 23:28:02 +00:00
Little clean up
This commit is contained in:
@@ -14,7 +14,7 @@ That gives us `0` through `9`. To get `1` through `10`, we can tweak it
|
|||||||
slightly:
|
slightly:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
> Array.apply(null, {length: 10}).map(Number.call, n => { return Number(n) + 1 });
|
> Array.apply(null, {length: 10}).map(Number.call, n => Number(n) + 1);
|
||||||
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ To generalize this, we can replace `10` with `N` and then just expect that
|
|||||||
```javascript
|
```javascript
|
||||||
> var N = 10;
|
> var N = 10;
|
||||||
=> undefined
|
=> undefined
|
||||||
> Array.apply(null, {length: N}).map(Number.call, n => { return Number(n) + 1 });
|
> Array.apply(null, {length: N}).map(Number.call, n => Number(n) + 1);
|
||||||
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user