Skip to content

Instantly share code, notes, and snippets.

@eliOcs
Created July 17, 2015 09:07
Show Gist options
  • Save eliOcs/5ead123b33954f3d99e2 to your computer and use it in GitHub Desktop.
Save eliOcs/5ead123b33954f3d99e2 to your computer and use it in GitHub Desktop.
This example tries to explain the function scope of javacript.
/*jslint node: true, maxlen: 80, indent: 4 */
"use strict";
var paco = "paco";
function fun1(paco) {
console.log(paco);
}
function fun2() {
var paco = "francisco";
return function fun3() {
console.log(paco);
};
}
console.log(paco);
fun1("kiko");
fun2()();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment