Skip to content

Instantly share code, notes, and snippets.

@imskojs
Created January 10, 2019 00:21
Show Gist options
  • Save imskojs/17bc5b1f7979f45a0304d85026b1f328 to your computer and use it in GitHub Desktop.
Save imskojs/17bc5b1f7979f45a0304d85026b1f328 to your computer and use it in GitHub Desktop.
// x is an Object object, not an array
var x = Object.create(Array.prototype)
// verify that x is definitely not an array
Array.isArray(x); // output: false
// but, x has array mehods like push
x.push('apple')
// seems to work just like an array
x[0] // output: 'apple'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment