Question: I'm trying to understand why this alerts to true? And how I would be able to alert false without passing arguments to the callback function (if possible)?

```
var a = true;

function foo(callback){
    var a = false;
    callback();
}

function bar(){
    alert(a);
}
foo(bar); // Alerts true

```

Answer: 
Since you use `var` when you say `a = false` you create a new, locally scoped, `a`. 

Get rid of the `var` if you want to modify the existing variable in the wider scope.
This:

```
var a = false;

```

...is local to the scope of the `foo` function.

This:

```
function bar(){
    alert(a);
}

```

...was created in the variable scope where `a = true`, and as such, closed over that local variable environment, and thus over that specific `a` variable.

It comes down to the fact that whenever you create a function, it *permanently retains* the variable scope in which it was created.

It doesn't matter if you pass that function into another environment. It will always only reference its original variable environment.

```
var test0 = 0;   // global variable environment

function a() {

    var test1 = 1;  // "a()" will always retain the global environment even if you
                    //      send "a()" somewhere else

    function b() {

        var test2 = 2;  // "b()" will always retain the environment of "a()" and the
                        //    global environment, even if you send "b()" somewhere else
    }
}

```

---

**EDIT:**

In order for `bar` to reference the variables local to `foo`, you could pass them in to `bar` as arguments:

```
var a = true;

function foo(callback){
    var a = false;
    callback( a );
}

function bar( a ){
    alert( a );
}
foo(bar); // now it alerts false

```

**Example:** <http://jsfiddle.net/dSZ4M/>

...you'll notice that I gave the parameter in `bar()` the same name as the global `a` variable. Because parameters to the function are read before variables outside the function's own variable environment, the `a` parameter *"shadows"* the global `a` variable.

As such, you can no longer read the global `a` from inside `bar`. Of course, all you'd need to do is change the name of the parameter to something else, like `arg` or whatever, and then you'd be able to reference both the local `arg` parameter and the global `a` variable.