KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
What is the best de-facto standard cross-browser method to determine if a variable in JavaScript is an array or not? Searching the web there are a number of different suggestions, some good and quite a few invalid. For example, the following is a basic approach: function isArray(obj) { return (obj && obj.length); } However, note what happens if the array is empty, or obj actually is not an array but implements a length property, etc. So which implementation is the best in terms of actually working, being cross-browser and still perform efficiently?
Tags (comma-separated)
Save Edits
Cancel