开发者

why do i need to combine two objects into one?

开发者 https://www.devze.com 2023-03-30 05:12 出处:网络
pm.mixin = function(/*Object*/ obj, /*Object...*/ props){ if(!obj){ obj = {}; } for(var i=1, l=arguments.length; i<l; i++){
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

精彩评论

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

关注公众号