I wrote the following code in Javascript.
function main()
{
this.a ;
this.set = function()
{
a = 1;
}
}
var l = new main();
alert("Initial value of a is "+ l.a );
l.set();
alert("after calling set() value of a is "+ l.a );
In both cases i got value of a as undefined .Why a is undefined even after I called set()?