with_namedfunc.js 610 B

123456789101112131415161718192021222324
  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 = { z: 0 };
  6. function test(param)
  7. {
  8. with (x)
  9. {
  10. z = function blah()
  11. {
  12. return param;
  13. }
  14. }
  15. }
  16. test("test1");
  17. WScript.Echo(x.z());
  18. test("test2");
  19. WScript.Echo(x.z());