Most of the time (tutorials mainly), I have seen “prototype” used for methods.
I’m pretty sure it can also be used for variables (perhaps the most useful for setting “default values”). Is there a reason it’s not often used for functions? Is it bad practice, or are there noticeable performance differences?
Think about it the other way round: Why would you want to store an object’s attribute in its prototype?
There’s two answers:
As gilly3 mentioned, 2. may just accidentally happen if you’re not absolutely sure what you’re doing. (Oh yes, it happened to me…)
Best practice:
unless you need shared access (and the attribute is object-typed).[edit]
[/edit]
And yes, the performance of using prototype is slightly worse than the other way. BUT you should never try to optimize things like that, since the performance gain is almost unnoticeable, yet the readability and maintainability of your code may suffer significantly.