Skip to content

Instantly share code, notes, and snippets.

@chasen-bettinger
Created March 15, 2017 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chasen-bettinger/da2d2bef07cc46a90a2b0108e70ebf79 to your computer and use it in GitHub Desktop.
Save chasen-bettinger/da2d2bef07cc46a90a2b0108e70ebf79 to your computer and use it in GitHub Desktop.
// check to see if a variable is an array
// from [Douglas_Crockford]_JavaScript_The_Good_Parts
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