<script>
function easycopy(args){
arraycopy(args.from,args.from_start || 0,
args.to,
args.to_start || 0,
args.length);
}
//here is you may invoke easycopy();
function testInvoke(){
var a = [1,2,3,5];
var b = new Array(4);
easycopy({from : a,to : b,length :4});
var total = 0;
for(var i= 0 ;i<b.length; i++){
total += b[i];
}
var publishName = document.getElementById("publishName");
publishName.value = total;
}
function arraycopy(/*array*/from,/*index*/from_start,/*array*/to,/*index*/to_start,/*length*/length){
for(var i=0;i<length;i++,to_start++,from_start++){
to[to_start] = from[from_start];
}
}
</script>
js中参数太长,可以传入对象的方式进行参数设置
最新推荐文章于 2021-09-09 15:57:23 发布