<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script type="text/javascript">
// function foo(x,y){
// arguments对象是 这个是ES5传统写法:表示获得传入的所有参数 Arguments { 0: 2, 1: 3, 2: 4, 3: 5, 4: 6, … }
//箭头函数中不支付arguments对象
// console.log(arguments);
// return x+y;
// }
//rest参数会获得函数调用的时候多余的参数...f
let foo = (x,y,...f) =>{
// 输出结果是:Array(3) [ 4, 5, 6 ] 3个参数,4,5,6是多余的
console.log(f);
return x+y;
}
// 调用的时候
let kk = foo(2,3,4,5,6);
// console.log(kk);
</script>
</body>
</html>
原文链接:https://www.qiquanji.com/post/7507.html
本站声明:网站内容来源于网络,如有侵权,请联系我们,我们将及时处理。
微信扫码关注
更新实时通知
