简单教程
提交运行
代码编辑器:
<script> function employee(name,jobtitle,born){ this.name=name; this.jobtitle=jobtitle; this.born=born; } var fred=new employee("Fred Flintstone","Caveman",1970); employee.prototype.salary=null; fred.salary=20000; document.write(fred.salary); </script>
运行结果: