이상한 Arguments 객체
/*
, .
:
There is no uniform handling of a variable named arguments amongst the various script engine implementations.
Example:
*/
<script>
function foo()
{
document.write(arguments);
document.write(arguments[0]);
eval("arguments = 10;");
document.write(arguments);
document.write(arguments[0]);
}
foo("test");
</script>
/*
Output:
IE: [object Object]test[object Object]test
FF: [object Object]test10undefined
Opera: testtest10undefined
Safari: [object Arguments]test10undefined
[color=red]Note:[/color]
Refer §10.1.6 - arguments is added as a {DontDelete} property to the “variable object” before the variable instantiations steps (§10.1.3) take place. Now, consider the following:
*/
<script>
function foo()
{
document.write(arguments);
document.write(arguments[0]);
arguments = 10;
document.write(arguments);
document.write(arguments[0]);
}
foo(42);
</script>
/*
And here is the outputs:
IE: [object Object]4210undefined
FF: same as IE
Opera: 424210undefined
Safari: [object Arguments]4210undefined
[color=red]Note: [/color]
In JScript arguments isn‟t included in the variable context that is used by the eval, so the eval‟ed assignment isn‟t actually changing the value of the enclosing functions arguments variable.
*/
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
【Microsoft Edge 편리 기능】URL 바를 카피하면 타이틀을 포함한 Markdown 형식으로 붙여넣기 가능업무로 이용하고 있는 Microsoft 계정으로 관리를 할 수 있는 것이 일인으로 보급되었던 Microsoft Edge에는, URL을 타이틀도 포함한 Markdown 형식으로 copipe 할 수 있는 편리한 기능이 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.