Posted By

micmath on 06/23/08


Tagged


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

SpinZ
sundaramkumar
guido


is it an array?


 / Published in: JavaScript
 

Cribbed from Crockford's "JavaScript: The good parts."

  1. var isArray = function(value) {
  2. return value &&
  3. typeof value === 'object' &&
  4. typeof value.length === 'number' &&
  5. typeof value.splice === 'function' &&
  6. !(value.propertyIsEnumerable('length'));
  7. };

Report this snippet  

You need to login to post a comment.