I am trying to learn about closures in javascript and I came across the following example:

```
function counter() {
    var count = 0;
    return function() {
        alert(count++);
    }
}
var count = counter();
count();
count();
count();

```

Which makes sense to me, my question is, why doesn't this work?

```
var count = function() {
    var count = 0;
    return function() {
        alert(count++);
    }
};
count();
count();
count();

```

To me it seems like it should be the exact same thing but maybe I'm just missing something obvious, please assist.