Skip to content

Instantly share code, notes, and snippets.

@seykron
Last active December 23, 2015 02:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seykron/6567337 to your computer and use it in GitHub Desktop.
Save seykron/6567337 to your computer and use it in GitHub Desktop.
Test for JavaScript lexical scope and first-class functions.
var logger = function (level) {
return function (message) {
console.log(level + " " + message);
};
};
var info = logger("INFO");
var debug = logger("DEBUG");
info("Information event");
debug("Debugging event");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment