I want to extend object in dojo similar to this from jQuery
var x = $.extend({}, obj1, obj2);
Is this a solution
var x;
dojo.extend(x,obj1);
dojo.extend(x,obj2);
Or can I do
dojo.extend(x,obj1,obj2);
Is this available
var x = dojo.exten开发者_开发知识库d(obj1, obj2);
If you want to implement the same semantics as $.extend(), you have to use dojo.mixin() instead of dojo.extend() (which extends prototypes):
var x = dojo.mixin({}, obj1);
dojo.mixin(x, obj2);
EDIT: If you want to keep the code on one line, you can do:
var x = dojo.mixin(dojo.mixin({}, obj1), obj2);
精彩评论