newFromArgs.js 816 B

123456789101112131415161718192021222324252627
  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. var a1 = f(undefined)[1];
  12. var a2 = f(undefined)[1];
  13. WScript.SetTimeout(testFunction, 50);
  14. /////////////////
  15. function testFunction()
  16. {
  17. telemetryLog(`${a1}`, true);
  18. telemetryLog(`${a2}`, true); // undefined in array parameter should still be set (legacy behavior is missing value)
  19. emitTTDLog(ttdLogURI);
  20. }