Skip to content

Instantly share code, notes, and snippets.

@Uvacoder
Forked from whoisryosuke/broken-array.js
Created October 18, 2022 16:10
Show Gist options
  • Select an option

  • Save Uvacoder/f0a7842246b6c935501b1f8dc81eb578 to your computer and use it in GitHub Desktop.

Select an option

Save Uvacoder/f0a7842246b6c935501b1f8dc81eb578 to your computer and use it in GitHub Desktop.
JS - Broken array mapping -- need to use `[...new Array(16)]`
new Array(16)
.map((_, index) => {
console.log('first', index)
return index
})
.reverse()
.map((index) => console.log(index))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment