The following piece of javascript code is going to work fine. function tryVariableArguments() { var intCnt = 0; for (intCnt = 0; intCnt < tryVariableArguments.arguments.length; intCnt++) { alert(tryVariableArguments.arguments[intCnt]); } } Trial Page tryVariableArguments('1','2','3'); tryVariableArguments('1','2'); tryVariableArguments();
B
Correct answer
Explanation
The code uses the deprecated 'arguments' property of functions (tryVariableArguments.arguments) which was removed in modern JavaScript strict mode and is considered legacy. Even in non-strict mode, accessing arguments through the function object (functionName.arguments) is non-standard. The correct approach is using the implicit 'arguments' object within the function scope. Therefore, the code is not going to work fine in modern JavaScript environments.