2

I have a function in collection view:

addAll: function() {
  console.log(this.collection);
  console.log(this.collection.length);
  console.log(this.collection.models);
  this.collection.each(this.addOne);
},

Why the results are:

1.

d
_byCid: Object
_byId: Object
length: 6
models: Array[6]
__proto__: x

2. 0

3. []

we can see the this.collection have models and length = 6 in the first result

mu is too short
  • 426,620
  • 70
  • 833
  • 800
Bruce Dou
  • 4,673
  • 10
  • 37
  • 56

1 Answers1

3

Beware console.log can cheat you

Community
  • 1
  • 1
fguillen
  • 36,125
  • 23
  • 149
  • 210