Skip to content

Instantly share code, notes, and snippets.

@sematgt
Created January 9, 2021 09:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sematgt/90faa57e8407030429cab12f652f8524 to your computer and use it in GitHub Desktop.
Save sematgt/90faa57e8407030429cab12f652f8524 to your computer and use it in GitHub Desktop.
array creation via mapping function
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