From 3c4b21ca0f9b8e697fb4076cdd50d4be14880e40 Mon Sep 17 00:00:00 2001 From: David Wu Date: Wed, 3 Jan 2018 12:42:11 +0100 Subject: [PATCH] Fix end inclusive error --- snippets/initializeArrayWithRange.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/initializeArrayWithRange.md b/snippets/initializeArrayWithRange.md index 38945c1b3..53cf27d4d 100644 --- a/snippets/initializeArrayWithRange.md +++ b/snippets/initializeArrayWithRange.md @@ -8,7 +8,7 @@ You can omit `step` to use a default value of `1`. ```js const initializeArrayWithRange = (end, start = 0,step = 1) => - Array.from({length:Math.ceil((end + 2 - start - step)/step)}).map((v, i) => (i * step) + start); + Array.from({length:Math.ceil((end + 1 - start)/step)}).map((v, i) => (i * step) + start); ``` ```js