これら2つのアプローチの違いは何だろうか。どちらも機能しますが、2番目のアプローチが望ましくない影響を与えるかどうかわかりませんか?
// A. Putting a prototype method outside the function declaration (what I would normally do)
var Cat = function(){
}
Cat.prototype.eat = function(){
// implementation
}
// B. Putting a prototype method inside the function declaration (it works too but the scoping seems different)
var Cat = function(){
Cat.prototype.eat = function(){
// implementation
}
}