Skip to content

Instantly share code, notes, and snippets.

@emilhein
Last active March 25, 2022 12:32
Show Gist options
  • Save emilhein/0758a345b9415454ca0d6aa25767519e to your computer and use it in GitHub Desktop.
Save emilhein/0758a345b9415454ca0d6aa25767519e to your computer and use it in GitHub Desktop.
let obj = [...Array(11).keys()].reduce((prev, current) => {
prev[current] = true
return prev
}, {})
console.log(obj);
/*
{ 0: true,
1: true,
2: true,
3: true,
4: true,
5: true,
6: true,
7: true,
8: true,
9: true,
10: true }
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment