开发者

why do i need to combine two objects into one?

pm.mixin = function(/*Object*/ obj, /*Object...*/ props){
        if(!obj){ obj = {}; }
        for(var i=1, l=arguments.length; i<l; i++){
            mixin(obj, arguments[i]);
        }
        return obj; // Object
};

This a dojo mixin function http://docs.dojocampus.org/dojo/开发者_运维百科mixin#id2

Can anyone say me on what scenario this would be useful for me, why do i need to combine two objects into one. What is arguments.length, i don't even pass this...


Can anyone say me on what scenario this would be useful for me, why do i need to combine two objects into one.

  • When subclassing
  • When you want to override defaults as per the example you linked to in the question!

What is arguments.length

The arguments object contains the arguments passed to a function.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜