Will Klein
Design systems developer advocate. Co-organizer @ReactDenver. Full-time dad. I ❤️ ice cream.
var f = function() {
var a = 1;
if (true) {
var a = 2;
}
return a; // 2
};
var g = function() { b = 1; var b = b + 2;
return b; // 3 };
var g = function() {
var b; b = 1; b = b + 2;
return b; // 3 };
var g1 = 'g1 is a global';
g2 = 'g2 is a global';
(function() {
var l = 'This is local';
g3 = 'g3 is also a global';
})();
var a = 1; // a: 1
(function() { var a = 2 // a: 2
(function() { var a = 3; // a: 3 })();
(function(a) {
// a: 4
})(4); })();
// a: 1
(function() {
var a = 1;
(function() {
a++;
})();
// a: 2
})();
var count = (function() { var count = 0; return function() { count = count + 1; return count; }; })();
count(); // 1 count(); // 2
By Will Klein
For fun, Jun 18, 2014
Design systems developer advocate. Co-organizer @ReactDenver. Full-time dad. I ❤️ ice cream.