js方法传参规则
作者:互联网
js方法传参规则:
一个萝卜一个坑的原则,萝卜多了没用坑,萝卜就会被舍弃
代码结果展示:
示例代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
</body>
<script type="text/javascript">
function test(a, b, c, d) {
console.log("a:" + a + ",b:" + b + ",c:" + c + ",d:" + d);
}
test(1);
test(1,2);
test(1,2,3);
test(1,2,3,4);
test(1,2,3,4,5);
</script>
</html>
标签:传参,萝卜,代码,js,规则,test 来源: https://blog.csdn.net/qq_36521848/article/details/123230327