javascript - Why is this parameter not used? -



javascript - Why is this parameter not used? -

in backbone 1.1.2, @ line 279

// homecoming re-create of model's `attributes` object. tojson: function(options) { homecoming _.clone(this.attributes); },

options not used, why have there @ all. wasted memory.

what missing here?

per comment here 1 way of calling code -so why pass options when not used?

tojson: function(options) { homecoming this.map(function(model){ homecoming model.tojson(options); }); },

it doesn't waste memory, since argument have available arguments[0] anyway (either options function phone call , vm has side-effects anyway, or it's object , it's reference).

it serves document reference superclasses can implement. since js using prototypes object orientation, if create tojson function in 1 of superclasses, it'll used instead.

javascript backbone.js

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -