InternalToString.js 923 B

12345678910111213141516171819202122
  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 a = new Object();
  6. a.toString = function() { WScript.Echo("In toString() "); return "foo" }
  7. var v = String.prototype.toLowerCase.call(a);
  8. WScript.Echo("Test call ToString - user defined object: " + v);
  9. a = true;
  10. v = String.prototype.toLowerCase.call(a);
  11. WScript.Echo("Test call ToString - bool: " + v);
  12. a = 123
  13. v = String.prototype.toLowerCase.call(a);
  14. WScript.Echo("Test call ToString - number: " + v);
  15. a = new Date();
  16. a.setTime(20000)
  17. v = String.prototype.toLowerCase.call(a);
  18. WScript.Echo("Test call ToString - date: " + v);