// Option A
function Monster() {
this.growl = () => {
console.log ("Grr!");
}
}
// Option B
function Monster() {};
Monster.prototype.growl =() => {
console.log("Grr!");
}
Option A는 1000개의 메소드가 생성이되고, Option B는 1개의 메소드가 생성이 된다.
https://onecompiler.com/javascript/3ynj3u3wf
https://medium.com/@bluesh55/javascript-prototype-%EC%9D%B4%ED%95%B4%ED%95%98%EA%B8%B0-f8e67c286b67