length.js 820 B

123456789101112131415161718192021222324252627282930
  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 print = function () { WScript.Echo.apply(this, arguments) };
  6. try
  7. {
  8. Object.prototype.createFunction=function()
  9. {
  10. print("createFunction called");
  11. print(this);
  12. return this
  13. }
  14. Object.prototype.length=function()
  15. {
  16. print("length called");
  17. return this
  18. };
  19. var c = "x";
  20. x = c.createFunction();
  21. x.length();
  22. x.length();
  23. }
  24. catch (e)
  25. {
  26. print(e);
  27. }