From 852ad3cc5f478c719bc11c933737e3733a4a9b3b Mon Sep 17 00:00:00 2001 From: Isabelle Viktoria Maciohsek Date: Sun, 18 Oct 2020 20:23:33 +0300 Subject: [PATCH] Update arithmeticProgression --- snippets/arithmeticProgression.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/arithmeticProgression.md b/snippets/arithmeticProgression.md index c7996a735..aab41ce2f 100644 --- a/snippets/arithmeticProgression.md +++ b/snippets/arithmeticProgression.md @@ -3,13 +3,13 @@ title: arithmeticProgression tags: math,beginner --- -Returns an array of numbers in the arithmetic progression starting with the given positive integer and up to the specified limit. +Creates an array of numbers in the arithmetic progression, starting with the given positive integer and up to the specified limit. - Use `Array.from()` to create an array of the desired length, `lim/n`, and a map function to fill it with the desired values in the given range. ```js const arithmeticProgression = (n, lim) => - Array.from({ length: Math.ceil(lim / n) }, (v, i) => (i + 1) * n ); + Array.from({ length: Math.ceil(lim / n) }, (_, i) => (i + 1) * n ); ``` ```js