Skip to content

Instantly share code, notes, and snippets.

@pocotan001
Last active April 8, 2019 04:42
Show Gist options
  • Save pocotan001/d805ad631af91a8137d217f92d1a4d44 to your computer and use it in GitHub Desktop.
Save pocotan001/d805ad631af91a8137d217f92d1a4d44 to your computer and use it in GitHub Desktop.
Loop for N times
const n = 10
Array.apply(null, Array(n)).forEach( … )
// or
[...Array(n).keys()].forEach( … )
// or
Array(n).fill().forEach( … )
// or
Array.from({ length: n }).forEach( … )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment