---
title: "Comment by Steven Olsen on \"101 Ways to Work with Arrays in JavaScript\" | Hashnode"
description: "One of my favourite util functions using Array.from: const listRange = ( begin, end, inc = 1 ) =&gt; Array .from({ length : Math .ceil((end - begin) / inc) }, ("
url: "https://hashnode.com/posts/101-ways-to-work-with-arrays-in-javascript/63b32f68ff3b3100c0927696/comment/63b5d83573ee0387bc7a8f07"
---

[Discussion](https://hashnode.com/posts/101-ways-to-work-with-arrays-in-javascript/63b32f68ff3b3100c0927696)

Comment [101 Ways to Work with Arrays in JavaScript](https://hashnode.com/posts/101-ways-to-work-with-arrays-in-javascript/63b32f68ff3b3100c0927696)

[Steven Olsen](https://hashnode.com/@srjsdev)

[Jan 4, 2023](https://hashnode.com/posts/101-ways-to-work-with-arrays-in-javascript/63b32f68ff3b3100c0927696/comment/63b5d83573ee0387bc7a8f07)

One of my favourite util functions using Array.from:

```
const listRange = (begin, end, inc = 1) =>
  Array.from({ length: Math.ceil((end - begin) / inc) }, (_, i) => begin + i * inc);

// console.log(listRange(0, 4, 1)); // [0, 1, 2, 3]
// console.log(listRange(0, 4)); // [0, 1, 2, 3]
// console.log(listRange(1, 10, 2)); // [1, 3, 5, 7, 9]
```
