Created
April 9, 2015 02:37
-
-
Save chrishan17/66b8178a453d8bbbad37 to your computer and use it in GitHub Desktop.
JavaScript If a variable is an array
This file contains 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
var is_array = function (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