Ember.isArray()

isArray (obj) Booleanpublic

Defined in packages/ember-runtime/lib/utils.js:20

Returns true if the passed object is an array or Array-like.

Objects are considered Array-like if any of the following are true:

  • the object is a native Array
  • the object has an objectAt property
  • the object is an Object, and has a length property

Unlike Ember.typeOf this method returns true even if the passed object is not formally an array but appears to be array-like (i.e. implements Ember.Array)

Ember.isArray();                                          // false
Ember.isArray([]);                                        // true
Ember.isArray(Ember.ArrayProxy.create({ content: [] }));  // true

Parameters:

obj Object
The object to test

Returns:

Boolean
true if the passed object is an array or Array-like
doc_EmberJs
2016-11-30 16:51:31
Comments
Leave a Comment

Please login to continue.