---
title: "Discussion on \"🔥 Create number ranges in JavaScript\" | Hashnode"
description: "Discussion on \"🔥 Create number ranges in JavaScript\". To get a range of numbers in JavaScript, initialize an array by spreading the keys of another array into it. You can shift the range up or down, or do things like have it contain only even numbers.\nconst range = [...Array(5).keys()] // ⇒ [0, 1, 2, 3,..."
url: "https://hashnode.com/posts/create-number-ranges-in-javascript/5fde5277b78ac62dff80ce3c"
---

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

Discussion

# [🔥 Create number ranges in JavaScript](https://domhabersack.hashnode.dev/create-number-ranges-in-javascript?utm_source=hashnode&utm_medium=feed)

To get a range of numbers in JavaScript, initialize an array by spreading the keys of another array into it. You can shift the range up or down, or do things like have it contain only even numbers. const range = \[...Array(5).keys()\] // ⇒ \[0, 1, 2, 3,...

Dec 19, 2020 · 1 min read · domhabersack.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#web-development](https://hashnode.com/tag/web-development)

## Written by

[Dom Habersack](https://hashnode.com/@domhabersack)

@domhabersack

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

Teaching everything I know.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
