In the above case "this" keyword still refers to the outside context, so if you execute the above code at the root scope for instance, this
refers to window. So you're actually just setting a property called "zee5" on the window.
You can console.log(this) anywhere in your code to see what it's pointing to.
If you want to bind the property to a function, you could do something like below, and assign the function to a variable rather than use a function declaration.
E.g. if you changed the code to the below it might work as you think:
var zee5 = "Variable Outside";
var magical = function(){
alert( this.zee5 );
}
// sets property zee5 on the variable magical
magical.zee5 = "Variable Inside";
// will alert the property set on magical
alert(magical.zee5)
// when the below executes, "this" still refers to window
magical();
// implicitly calling window.zee5, if done from root context
alert( zee5 );
But I think what you might be doing is confusing the way new objects are declared in js. For example if you did the following, changing the approach to use the function declaration as a constructor, then the context will change to the object you've just declared and you'll also get what you're expecting:
var zee5 = "Variable Outside";
function magical( )
{
this.zee5 = "Variable Inside";
alert( this.zee5 );
}
// will create an object of type magical
// this refers to the new object inside the constructor function
var mag = new magical();
alert( zee5 );