Reputation: 47595
This page says to use:
var object = $.extend({}, object1, object2);
But I prefer to scope everything. So if I had a local scope explicitly declared, could I use:
var local = {};
$.extend(local.object, object1, object2);
instead of saying this:
var local = {};
local.object = $.extend({}, object1, object2);
Upvotes: 0
Views: 136
Reputation: 4541
Have you ever tried this approach?
var local = { object: {} };
$.extend(local.object, object1, object2);
btw, I didn't see problem with the third approach.
Upvotes: 1