let_stackfunc.js 967 B

12345678910111213141516171819202122232425262728293031323334353637
  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 = "glo";
  6. function test(yes, param)
  7. {
  8. function nested() { return param + x; }
  9. if (yes)
  10. {
  11. let x = nested() + " yes";
  12. let f = function() { WScript.Echo(x); }
  13. f();
  14. }
  15. else
  16. {
  17. for (var i = 0; i < 2; i++)
  18. {
  19. let x;
  20. if ( i == 0) {x = "0"; }
  21. let f2 = function() { WScript.Echo(x); }
  22. let f3 = function() { WScript.Echo("f3" + x); }
  23. f2();
  24. f3();
  25. }
  26. }
  27. }
  28. test(true, "test1");
  29. test(true, "test2");
  30. test(false, "test3");