Created
January 9, 2021 09:09
-
-
Save sematgt/90faa57e8407030429cab12f652f8524 to your computer and use it in GitHub Desktop.
array creation via mapping function
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
const obj = { | |
length: 4, | |
0: 'one', | |
1: 'two', | |
2: 'three', | |
}; | |
console.log(Array.from(obj, (v, i) => { | |
if (v === undefined) { | |
return 'no element'; | |
} else { | |
return v; | |
} | |
})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment