Created
August 1, 2012 08:17
-
-
Save philipjkim/3224895 to your computer and use it in GitHub Desktop.
Check if an object 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 isArray = function(o){ | |
return Object.prototype.toString.call(o) === '[object Array]'; | |
}; | |
console.log(isArray(['Soo', 'Philip', 'Kim'])); // true | |
console.log(isArray({first: 'Soo', middle: 'Philip', last: 'Kim'})); // false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment