중히 여기다:
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 에 호출 body.onload이벤트 .
기대했다 shape1.hasOwnProperty(name)true를 반환 했지만 false를 반환합니다.
올바른 행동은 무엇입니까?
"name"반대name