Last active
March 25, 2022 12:32
-
-
Save emilhein/0758a345b9415454ca0d6aa25767519e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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