arguments
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <script> // fn(2,4); // fn(2,4,6); // fn(2,4,6,8); // // function fn(a,b,c) { // console.log(arguments); // console.log(fn.length); // console.log(arguments.length); // // console.log("----------------"); // } fn(2,4); fn(2,4,6); fn(2,4,6,8); function fn(a,b) { arguments[0] = 99; console.log(arguments)//将实参的第一个数改为99 // arguments.push(8); //此方法不通过,因为无法增加元素 } </script> </body> </html>

浙公网安备 33010602011771号