I am using Backbone.js, and in an overriden collection's add
method I'm trying to copy an array with slice
, the following way :
var modelsBefore = this.models.slice(0);
console.log('COPIED', modelsBefore, this.models);
But copy doesn't seem to work, here's what my (chromium) log shows :
COPIED [] [child]
Any idea what could cause this ?
EDIT :
Here's a jsfiddle that reproduces the problem: http://jsfiddle.net/hYDbw/5/