javascript可变参数函数
2009-02-22 22:23 Iron 阅读(971) 评论(0) 编辑 收藏 举报<script language="JavaScript">
function MyArray()
{
this.length=arguments.length;
for(var i=0;i<this.length;i++)
{
this[i]=arguments[i];
}
}
var str="";
var arr=new MyArray(4,3.5,"abc");
for(i=0;i<arr.length;i++)
{
str+=arr[i]+"\n";
}
alert(str);
</script>