CodeWars——js

function Person(name){
  this.name = name;
}

Person.prototype.greet = function(otherName){
  console.log( "Hi " + otherName + ", my name is " + this.name);//原来是name,改为this.name
}

你可能感兴趣的:(JavaScript)