1. <script>
    2. function config(baseURL, ...other) {
    3. console.log(baseURL);
    4. // other 是真数组,动态获取实参
    5. console.log(other);
    6. }
    7. // 调用函数
    8. config('http://baidu.com', 'get', 'json');
    9. </script>

    总结:

    1. ... 是语法符号,置于最末函数形参之前,用于获取多余的实参
    2. 借助 ... 获取的剩余实参