一个小程序,结果为什么全显示undefine?
<html><head>
<title>无标题文档</title>
</head>
<body>
<script>
function person(name,age)
{this.name=name;
this.age=age;
}
function book(title,publisher,price,author)
{this.title=title;
this.publisher=publisher;
this.price=price;
this.author=author;
}
function show(obj)
{var prop;
for(prop in obj)
document.write(obj.prop+" ");
document.write("<br>");
}
var obj1=new person("yqiong","20");
var obj2=new book("web程序设计","电子工业出版","$28","吉根林");
show(obj1);
show(obj2);
</script>
</body>
</html>