Skip to content

Instantly share code, notes, and snippets.

@ferreiratiago
Last active September 27, 2017 09:32
Show Gist options
  • Save ferreiratiago/088396b05141fb66fa22507b476f78f5 to your computer and use it in GitHub Desktop.
Save ferreiratiago/088396b05141fb66fa22507b476f78f5 to your computer and use it in GitHub Desktop.
JS WTF
var example = { length: 3 } // An array-like object
// When executing 'Array.apply(null, example)'
// Array will be executed with its arguments being the properties' values from 0...length - 1
Array(example[0], example[1], example[2])
// Which translates into
Array(undefined, undefined, undefined) // [ undefined, undefined, undefined ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment