Javascript:参数数组是否已弃用?

大多数网站都说被调用者"作为 Function.arguments 的属性已被弃用.但是有些网站走得更远,说整个 Functions.argument 已被弃用,例如http://aptana.com/reference/api/Arguments.html 如果整个例程是死在水里?我刚刚发现参数",它似乎非常有用例如:http://hungred.com/how-to/secret-arguments-array-javascript/

Most sites say "callee" as a property of Function.arguments is deprecated. But some sites go further and say the whole of Functions.argument is deprecated E.g. http://aptana.com/reference/api/Arguments.html Why only mention callee if the whole routine is dead in the water? I only just discovered "arguments" and it seems incredibly useful E.g: http://hungred.com/how-to/secret-arguments-array-javascript/

推荐答案

Function.arguments is 已弃用,但它只是弃用了原版 arguments 在函数中可用的对象.(例如,使用 x = arguments[i]; 而不是 x = theFunc.arguments[i];)

Function.arguments is deprecated, but it's only deprecated in favor of the vanilla arguments object that's available within a function. (e.g. using x = arguments[i]; instead of x = theFunc.arguments[i];)

现在这是访问收到的序数参数的首选方法(正如您所说,非常有用).

That's now the preferred (and as you say, extremely useful) method for accessing the ordinal arguments received.

相关文章