Created
October 19, 2011 14:57
-
-
Save takumakei/1298538 to your computer and use it in GitHub Desktop.
is_array
This file contains hidden or 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
// is_array():bool | |
// "JavaScript: The Good Parts by Douglas Crockford. Copyright 2008 Yahoo! Inc., 978-0-596-51774-8." | |
function is_array(value) { | |
return value && | |
typeof value === 'object' && | |
typeof value.length === 'number' && | |
typeof value.splice === 'function' && | |
!(value.propertyIsEnumerable('length')); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment