mixedscope.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. let level1Func_1 = function level_1_identifier_0() {
  6. const a= 1;
  7. function level2Func() {
  8. eval("print(a)");
  9. }
  10. level2Func();
  11. }
  12. level1Func_1();
  13. var level1Func_2 = function level_1_identifier_0() {
  14. let level_1_identifier_2= "level1";
  15. function level2Func() {
  16. print(typeof level_1_identifier_0);
  17. level_1_identifier_2 += "level2";
  18. }
  19. level2Func();
  20. print(level_1_identifier_2);
  21. }
  22. level1Func_2();
  23. function a() {
  24. const x = 'x';
  25. const y = 'y';
  26. function b() {
  27. return true ? 0 : x
  28. }
  29. function c() {
  30. return false ? y : 1
  31. }
  32. print(b());
  33. print(null);
  34. print(c());
  35. print(null);
  36. }
  37. a();
  38. function print(x) { WScript.Echo(x); }