Created
March 15, 2014 16:16
-
-
Save hidoos/9569777 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="js函数的arguments的值" /> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function foo(x,y,z){ | |
//参数定义的形参 | |
console.log('参数定义的形参:',foo.length); | |
//函数的arguments属性 | |
console.log("函数的arguments属性:",arguments.callee == foo); | |
//实际传递的参数个数 | |
console.log("实际传递的参数个数:",arguments.length); | |
//arguments对应properties-index是和实际参数是共享的 | |
arguments[0] = 'hidoos'; | |
console.log("arguments对应properties-index是和实际参数是共享的x",x); | |
y = "man"; | |
console.log("y:",arguments[1]); | |
// 没有实际传递参数的话就没共享 | |
arguments[2] = "argument2:haha"; | |
console.log('arguments[2]',z); | |
z = "z"; | |
console.log('z:',z); | |
console.log('arguments[2]',arguments[2]); | |
} | |
foo(10,20); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment