Files
30-seconds-of-code/test/geometricProgression/geometricProgression.js
2018-01-09 06:09:49 -05:00

4 lines
161 B
JavaScript

module.exports = (end, start = 1, step = 2) =>
Array.from({ length: Math.floor(Math.log(end / start) / Math.log(step)) + 1 }).map(
(v, i) => start * step ** i
);