resolveToken.js (605B)
1 const a = 1; 2 let b = 0; 3 4 function getA() { 5 return a; 6 } 7 8 function setB(newB) { 9 b = newB; 10 } 11 12 const plusAB = (function(x, y) { 13 const obj = { x, y }; 14 function insideClosure(alpha, beta) { 15 return alpha + beta + obj.x + obj.y; 16 } 17 18 return insideClosure; 19 })(a, b); 20 21 function withMultipleScopes() { 22 var outer = 1; 23 function innerScope() { 24 var inner = outer + 1; 25 return inner; 26 } 27 28 const fromIIFE = (function(toIIFE) { 29 return innerScope() + toIIFE; 30 })(1); 31 32 { 33 // random block 34 let x = outer + fromIIFE; 35 if (x) { 36 const y = x * x; 37 console.log(y); 38 } 39 } 40 }