Update arithmeticProgression

This commit is contained in:
Isabelle Viktoria Maciohsek
2020-10-18 20:23:33 +03:00
parent a2dc83e9a9
commit 852ad3cc5f

View File

@ -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