cross_scope.js 633 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 i = 0;
  6. function test(param)
  7. {
  8. var nested;
  9. function init(param2)
  10. {
  11. nested = function() { return param + param2; }
  12. }
  13. init(i++);
  14. return nested();
  15. }
  16. WScript.Echo(test("test1"));
  17. WScript.Echo(test("test2"));