dateBasic.js 923 B

1234567891011121314151617181920212223242526272829
  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. var x = new Date();
  6. var y = x;
  7. var z = new Date(2012, 1);
  8. y.foo = 3;
  9. var w = Date.now();
  10. WScript.SetTimeout(testFunction, 50);
  11. /////////////////
  12. function testFunction()
  13. {
  14. telemetryLog(`x === y: ${x === y}`, true); //true
  15. telemetryLog(`w !== z: ${w !== z.valueOf()}`, true); //true
  16. telemetryLog(`y.foo: ${y.foo}`, true); //3
  17. telemetryLog(`x.foo: ${x.foo}`, true); //3
  18. telemetryLog(`w - z > 0: ${w - z.valueOf() > 0}`, true); //true
  19. telemetryLog(`x - y: ${x.valueOf() - y.valueOf()}`, true); //0
  20. }