For a very simple range in ES6:
let range = n => Array.from(Array(n).keys())
From bigOmega’s comment, this can be shortened using Spread syntax:
let range = n => [...Array(n).keys()]
More Related Contents:
- Running python on client side
- How to construct a progress bar from the given percentage?
- Web-scraping JavaScript page with Python
- Display data streamed from a Flask view as it updates
- WebDriver click() vs JavaScript click()
- How can I pass data from Flask to JavaScript in a template?
- Getting the return value of Javascript code in Selenium
- Django csrf token + Angularjs
- How can I execute a python script from an html button?
- Display the contents of a log file as it is updated
- Find the longest common starting substring in a set of strings [closed]
- Scrolling to top of the page in Python using Selenium
- Accessing Shadow DOM tree with Selenium
- How to call python script from NodeJs
- How to decrypt password from JavaScript CryptoJS.AES.encrypt(password, passphrase) in Python
- Returning JSON array from a Django view to a template
- How to disable a “Reload site? Changes you made may not be saved” popup for (python) selenium tests in chrome?
- How can I pass parameter through serialization and then parse them using external JavaScript?
- How can I integrate Python and JavaScript?
- How to get html with javascript rendered sourcecode by using selenium
- How to download an image with Python 3/Selenium if the URL begins with “blob:”?
- How do I download a file from FastAPI backend using Fetch API in the frontend?
- Does JavaScript support array/list comprehensions like Python?
- How do i take picture from client side(html) and save it to server side(Python)
- How can I have a host and container read/write the same files with Docker?
- Make Javascript do List Comprehension
- Return data from html/js to python
- How to use the variables from “views.py” in JavasScript, “” in Django Template?
- sending data as JSON object from Python to Javascript with Jinja [duplicate]
- How do I download a file from FastAPI backend using JavaScript Fetch API in the frontend?