JavaScript Date 對象javascript
prototype 屬性使您有能力向對象添加屬性和方法。java
object.prototype.name=value
在本例中,咱們將展現如何使用 prototype 屬性來向對象添加屬性:this
<script type="text/javascript"> function employee(name,job,born) { this.name=name; this.job=job; this.born=born; } var bill=new employee("Bill Gates","Engineer",1985); bill.salary=20000; document.write(bill.salary); </script> employee.prototype.salary=null;
輸出:spa
20000