You misunderstood the javascript prototype/object concepts.
For the first example you are right, the variable has a function scope
The second example is wrong. If you want to use a function as 'class' you have to create an object from it
function myFunction() { this.value = 0; }
var test = new myFunction;
only then you can access the 'value' property of it. for every 'new' statement a new object is created.
In third example you add a static property to function which can be accessed without creating an object. Different technique that's
Hope it helped