outOfScope.js (869B)
1 // Program Scope 2 3 function outer() { 4 function inner() { 5 const x = 1; 6 } 7 8 const arrow = () => { 9 const x = 1; 10 }; 11 12 const declaration = function() { 13 const x = 1; 14 }; 15 16 assignment = (function() { 17 const x = 1; 18 })(); 19 20 const iifeDeclaration = (function() { 21 const x = 1; 22 })(); 23 24 return function() { 25 const x = 1; 26 }; 27 } 28 29 function exclude() { 30 function another() { 31 const x = 1; 32 } 33 } 34 35 const globalArrow = () => { 36 const x = 1; 37 }; 38 39 const globalDeclaration = function() { 40 const x = 1; 41 }; 42 43 globalAssignment = (function() { 44 const x = 1; 45 })(); 46 47 const globalIifeDeclaration = (function() { 48 const x = 1; 49 })(); 50 51 function parentFunc() { 52 let MAX = 3; 53 let nums = [0, 1, 2, 3]; 54 let x = 1; 55 let y = nums.find(function(n) { 56 return n == x; 57 }); 58 function innerFunc(a) { 59 return Math.max(a, MAX); 60 } 61 return innerFunc(y); 62 }