Skip to content

Instantly share code, notes, and snippets.

@chrishan17
Created April 9, 2015 02:37
Show Gist options
  • Save chrishan17/66b8178a453d8bbbad37 to your computer and use it in GitHub Desktop.
Save chrishan17/66b8178a453d8bbbad37 to your computer and use it in GitHub Desktop.
JavaScript If a variable is an array
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