- function CreatPerson(name,age,job){
- this.name = name;
- this.age = age;
- this.job = job;
- this.sayName = function(){
- console.log(this.name);
- }
- }
- var person1 = new CreatPerson("Nicholas",18,"Software Engineer");
- var person2 = new CreatPerson("Greg",27,"Doctor");
转载于:https://www.cnblogs.com/jeremy-o/p/8472291.html