function Person(name){
this.name=name
this.sayName=function(){
console.log(this.name)
}
return{
sayName:this.sayName
}
}
var dingHaoRan = new Person('丁浩然')
function People (name){
this.name = name;
this.sayName = function(){
console.log('my name is:' + this.name);
}
}
People.prototype.walk = function(){
console.log(this.name + ' is walking');
}
var p1 = new People('饥人谷');
var p2 = new People('前端');
5: 创建一个 Car 对象,拥有属性name、color、status;拥有方法run,stop,getStatus