我想知道这两种方法有什么区别。它们都有效,但我不明白第二种方法是否会产生不良影响?
// 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
}
}