
Untitled
By: a guest on
May 7th, 2012 | syntax:
None | size: 0.78 KB | hits: 9 | expires: Never
var hi = "hello" // Global
function grandparent () {
var one = 1 // Private to `grandparent`, `parent`, and `child`
console.log( hi, one, two, three ) // hello, 1, undefined, undefined
parent()
function parent () {
var two = 2 // Private to `parent`, and `child`
console.log( hi, one, two, three ) // hello, 1, 2, undefined
child()
function child () {
var three = 3 // Private to `child`
console.log( hi, one, two, three ) // hello, 1, 2, 3
}
}
}
grandparent()
console.log( hi, one, two, three ) // hello, undefined, undefined, undefined
console.log( grandparent, parent, child ) // Function, undefined, undefined