Skip to content

Instantly share code, notes, and snippets.

@awilson28
Created January 16, 2015 18:29
Show Gist options
  • Save awilson28/6ecbdfbb8b254254e699 to your computer and use it in GitHub Desktop.
Save awilson28/6ecbdfbb8b254254e699 to your computer and use it in GitHub Desktop.
var arraylike = document.getElementsByTagName('p')
//we cannot do ‘typeof arraylike’ because this returns ‘object’ not ‘array’
Array.isArray(arraylike)   // false 
var realArr = Array.prototype.slice.call(arraylike)
Array.isArray(realArr)   //true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment