您的位置:首页 > 其它

codewars - Broken Greetings

2014-04-15 10:30 141 查看
http://www.codewars.com/


Broken Greetings


Description:


Correct this code, so that the greet function returns the expected value.

[b]MySolution:[/b]


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

Person.prototype.greet = function(otherName){
return "Hi " + otherName + ", my name is " + name;
}

Best Solution:

function Person(name){
this.name = name;
}
Person.prototype.greet = function(otherName){
return "Hi " + otherName + ", my name is " + this.name;
}


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: