Skip to content

Commit a396b73

Browse files
more README updates to align the demo code
1 parent 7a54312 commit a396b73

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ let chunksOf4 = Array.from(digits.values().chunks(4));
2929
A more flexible solution is a sliding window method, usually named `windows`:
3030

3131
```js
32-
let windowsOf3 = Array.from(digits.windows(3));
32+
let windowsOf3 = Array.from(digits.values().windows(3));
3333
// [ [0, 1, 2], [1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6], [5, 6, 7], [6, 7, 8], [7, 8, 9] ]
3434

35-
let windowsOf2AdvancingBy3 = Array.from(digits.windows(2, 3));
35+
let windowsOf2AdvancingBy3 = Array.from(digits.values().windows(2, 3));
3636
// [ [0, 1], [3, 4], [6, 7], [9] ]
3737
```
3838

3939
`chunks` is just a specialisation of `windows` where `chunks(n)` is equivalent to `windows(n, n)`.
4040

4141
```js
42-
let chunksOf4 = Array.from(digits.windows(4, 4));
42+
let chunksOf4 = Array.from(digits.values().windows(4, 4));
4343
// [ [0, 1, 2, 3], [4, 5, 6, 7], [8, 9] ]
4444
```
4545

0 commit comments

Comments
 (0)