猿问

这里打印的arguments为啥是null?

var a=3,b=4;function h(a,b){return a+b};console.dir(h)

function h(a.b)

arguments: null  这个为啥是null

caller: null

length: 2

name: "h"

prototype:Object

__proto__: function()

<function scope>


MMMHUHU
浏览 1089回答 1
1回答

叮当猫咪

function abc(x,y,z){ return arguments;};console.dir(abc);/*abc(x, y, z)arguments: null //没调用时没有caller: nulllength: 3&nbsp; //如果要获取参数个数,应该用 lengthname: "abc"prototype: abc__proto__: ()<function scope>*/console.dir(abc(1,2,3));/*[1, 2, 3]0: 11: 22: 3callee: abc(x,y,z)length: 3*/
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答