javascript print numbers in the given range

Solutions on MaxInterview for javascript print numbers in the given range by the best coders in the world

showing results for - "javascript print numbers in the given range"
Juan Esteban
15 Jan 2017
1const range = (min, max) => [...Array(max - min + 1).keys()].map(i => i + min);
2//or
3const range = (min, max) => Array.from({ length: max - min + 1 }, (_, i) => min + i);
4
5range(5, 10);   // [5, 6, 7, 8, 9, 10]