InternalToString.js 1.1 KB

12345678910111213141516171819202122232425262728
  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. function writeLine(v) {
  6. v = v.replace(/\(pdt\)/g, "(pacific daylight time)")
  7. .replace(/\(pst\)/g, "(pacific standard time)");
  8. WScript.Echo(v);
  9. }
  10. var a = new Object();
  11. a.toString = function() { writeLine("In toString() "); return "foo" }
  12. var v = String.prototype.toLowerCase.call(a);
  13. writeLine("Test call ToString - user defined object: " + v);
  14. a = true;
  15. v = String.prototype.toLowerCase.call(a);
  16. writeLine("Test call ToString - bool: " + v);
  17. a = 123
  18. v = String.prototype.toLowerCase.call(a);
  19. writeLine("Test call ToString - number: " + v);
  20. a = new Date();
  21. a.setTime(20000)
  22. v = String.prototype.toLowerCase.call(a);
  23. writeLine("Test call ToString - date: " + v);