---
title: "Discussion on \"101 Ways to Work with Arrays in JavaScript\" | Hashnode"
description: "Discussion on \"101 Ways to Work with Arrays in JavaScript\". (or Almost...)"
url: "https://hashnode.com/posts/101-ways-to-work-with-arrays-in-javascript/63b32f68ff3b3100c0927696"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [101 Ways to Work with Arrays in JavaScript](https://srjsdev.hashnode.dev/101-ways-to-work-with-arrays-in-javascript?utm_source=hashnode&utm_medium=feed)

(or Almost...)

Jan 2, 2023 · 4 min read · srjsdev.hashnode.dev  
Updated Feb 1, 2023  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#array-methods](https://hashnode.com/tag/array-methods)
-   [#functional-programming](https://hashnode.com/tag/functional-programming)
-   [#loops](https://hashnode.com/tag/loops)

## Written by

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

@srjsdev

  
[View profile](https://hashnode.com/@srjsdev)

Online educator and mentor for Sr. JS developers

With 20+ years of dev experience, I'm an online educator, mentor, and consultant--teaching practical, advanced topics to developers like you on how to write: ✅ new AI/LLM features ✅ maintainable JS code ✅ scalable web apps ...yup that's about it! 🎤

## Responses 2

Markdown supported · ⌘↵ to post

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

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

Bonus tip: how to turn your POO (plain old object) into an iteratable array!

```
const obj1 = {a: 1, b: 2};
obj1.__proto__[Symbol.iterator] = function* () {
  for (const k in this) yield [k, this[k]];
}
for (const e of obj1) console.log(e.join(":"))
// a:1
// b:2
```

[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]
```
