R
Reza Roby
The following code reports a runtime error "v has no properties."
function ff()
{
var v;
v.x=5; //error
alert(v.x);
}
But this one alerts "undefined":
function ff()
{
var v = 0;
v.x=5;
alert(v.x); //alert "undefined"
}
while generating no runtime warnings at all.
Is there a way to force javascript to report this type of error (in the
javascript console?)
PS:
I understand sometimes people may want to read an undefined, as a valid
value. However, it would be _very_ good if the rest of us can at least
get runtime warnings for that.
Thank you again for your help.
Reza.
function ff()
{
var v;
v.x=5; //error
alert(v.x);
}
But this one alerts "undefined":
function ff()
{
var v = 0;
v.x=5;
alert(v.x); //alert "undefined"
}
while generating no runtime warnings at all.
Is there a way to force javascript to report this type of error (in the
javascript console?)
PS:
I understand sometimes people may want to read an undefined, as a valid
value. However, it would be _very_ good if the rest of us can at least
get runtime warnings for that.
Thank you again for your help.
Reza.