Possible Duplicate:
JavaScript: Setting methods through prototype object or in constructor, difference?
I guess this is a question about the browsers implementation of closures really. I know about the numerous ways to emulate Class-like functionality within JavaScript including using various libraries. This is more a question about resources.
Does creating a function in this manner create a new copy of public_function
function each time it is called? the underlying question is: Does doing it this way use more RAM than adding the function to MyObject.prototype
?
function MyObject(){
this.public_function = function(){
//... do something
}
}