function copyProperties(/* object */from,  /* optional object */ to){
if (!to) to + {};
for (p in from) to [p] = from[p];
return to;
function copyUndefinedProperties(/* object */ from, /* object */ to){
for (p in from){
if (!p in to) to[p] =from[p];
}
}
看的半懂半不懂的,(/* object */from,  /* optional object */ to)    这条是什么意思 /* */ 这符号是什么意思?前面没解释,所以半懂半不懂

解决方案 »

  1.   

    /* */ 这是注释啊
    说明那个参数是object类型的啊!
      

  2.   

    function copyProperties(/* object */from,  /* optional object */ to){
    if (!to) to + {};
    for (p in from) to [p] = from[p];
    return to;
    function copyUndefinedProperties(/* object */ from, /* object */ to){
    for (p in from){
    if (!p in to) to[p] =from[p];
    }
    }
    就相当于
    function copyProperties(from,   to){
    if (!to) to + {};
    for (p in from) to [p] = from[p];
    return to;
    function copyUndefinedProperties(from,  to){
    for (p in from){
    if (!p in to) to[p] =from[p];
    }
    }
    个人意见