<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title></title> </head> <body> <!-- 函數內部參數 arguments:數組對象,主要用來保存函數的參數。 爲當前執行的 function 對象返回一個arguments 對象。 function.arguments function 參數是當前執行函數的名稱,可以省略。 說明: 通過 arguments 屬性,函數可以處理可變數量的參數。 arguments 對象的 length 屬性包含了傳遞給函數的參數的數目。 對於arguments 對象所包含的單個參數,其訪問方法與數組中所包含的參數的訪問方法相同。 --> <script> function a(){ alert(arguments[0]) alert(arguments[1]) alert(arguments[2]) } a('12','34','56') /*callee屬性:指向擁有arguments對象的函數*/ function b(){ alert(arguments.callee) } b(); /*函數調用語句所在的作用域。函數的調用者*/ function c(){ this.prompt('123') } c(); </script> </body>
</html>