Alex Rivera | Logout

In Ember.js, what is the difference between [] and Ember.A([])?

Asked 2012-04-27T05:13:26.540
35

While looking through apps written with Ember.js, I noticed that sometimes arrays are defined with a call to Ember.A() and sometimes array literals are used. When I ran Ember.A([1]) in the browser console, the return value looks just like an array and arrays created using array literals had the Ember.js methods pushObject and friends. Is the call to Ember.A() just a way to define an Ember.Array when you don't use prototype extensions? Otherwise are arrays all created equal?

Edit
Report

1 Answer

47

Your question contains the correct answer: Ember.A() just a way to define an Ember.Array when you have turned off the prototype extensions. You'll notice that Ember's internal code always uses Ember.A().

answered 2012-04-27T12:33:17.223

Your Answer