I have been trying to figure out how to get to a base js array so that I can loop over it
http://emberjs.com/documentation/#toc_the-enumerable-interface
This one is simple. To convert an Enumerable into an Array, simply
call its toArray method.
Now when i run the following test with either 1.pre and 0.9.8.1 the results are not what I’d expect.
> var msp = ["1","2","3"]
> msp
["1", "2", "3"]
> for (mp_c in msp) console.log(mp_c);
0
1
2
isEnumerable
nextObject
> for (mp_c in msp.toArray()) console.log(mp_c);
0
1
2
isEnumerable
nextObject
I would expect it to return a vanilla array, without any of the ember properties.
https://github.com/emberjs/ember.js/blob/master/packages/ember-runtime/lib/mixins/enumerable.js#L554
Ember actually applys methods onto the Array.prototype; meaning those methods will be on every array on the site (the Array object classes are actually changed, they do not change each instance).
This actually happens with a lot of javascript libraries so it is always best to iterate over the length (by best I really mean, least brittle using libraries like ember).
Edit: ij