<script type="text/javascript"> var total=null; function sum() { for(var i=0;i<arguments.length;i++){ if (typeof arguments[i]=="number" && !isNaN(arguments[i])){ total+=Number(arguments[i]); } //total+=!isNaN(arguments[i])?Number(arguments[i]):0; } return total } sum(1,2,[],'',{a:1},true) console.log(total); </script>
任意数求和
最新推荐文章于 2023-04-20 13:17:20 发布