59
rated 0 times
[
65]
[
6]
/ answers: 1 / hits: 144755
/ 14 Years ago, thu, april 8, 2010, 12:00:00
Consider:
function Shape() {
this.name = "Generic";
this.draw = function() {
return "Drawing " + this.name + " Shape";
};
}
function welcomeMessage()
{
var shape1 = new Shape();
//alert(shape1.draw());
alert(shape1.hasOwnProperty(name)); // This is returning false
}
.welcomeMessage
called on the body.onload
event.
I expected shape1.hasOwnProperty(name)
to return true, but it's returning false.
What is the correct behavior?
More From » javascript