newfromargs.js 633 B

123456789101112131415
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. Array.prototype[1] = 100;
  6. function f(param)
  7. {
  8. var a = new Array(1, param, 3);
  9. return a;
  10. }
  11. WScript.Echo(f(undefined)[1]);
  12. WScript.Echo(f(undefined)[1]); // undefined in array parameter should still be set (legacy behavior is missing value)