Is there some sort of standard or convention on naming JavaScript prototypes?
I find myself in the need to add methods on prototypes of both native and user-defined functions quite often, and so I usually store the prototypes themselves in local variables:
var functionPrototype = Function.prototype;
var objectPrototype = Object.prototype;
var arrayPrototype = Array.prototype;
Although the names are very descriptive, they are unnecessarily long.
I believe that there’s no standard convention on naming prototype objects. So I created my own standard.
As I mentioned in my comment above choosing a standard is just a matter of style or preference. However once you choose one you should stick to it.
Here’s the standard I use now:
In general here are the guidelines for naming a prototype:
Proto.This keeps very long constructor names like
Function,BooleanandRectangleshort while keeping longer names long.