Skip to content

@cowboy /simple-iife-example.js
Last active

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
IIFE: the simplest example i can contrive
var value, getValue;
value = 1;
getValue = function() { return value; };
value = 2;
getValue() // 2
var value, getValue;
value = 1;
getValue = (function(v) {
return function() { return v; };
}(value));
value = 2;
getValue() // 1
var value, getValue;
value = 1;
(function(v) {
getValue = function() { return v; };
}(value));
value = 2;
getValue() // 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.