JS支持可变参数(任意多个)

<script type="text/javascript">
    function abc(){
        //js中有个变量arguments,可以访问所有传入的值
        for(var i=0; i<arguments.length; i++){
            window.alert(arguments[i]);
        }
    }
    abc(2,5,6);
</script>

引用自:https://www.cnblogs.com/it80/p/7053736.html

posted @ 2020-05-08 10:36  吾爱春秋  阅读(541)  评论(0)    收藏  举报