Prototyping with the JavaScript Prototype Object
One of the most important features in JavaScript is the ability allow objects to inherit methods through the use of prototyping. Anyone who had a toolkit of JavaScript functions is well served by also putting to use prototypes to fill in the gaps where existing functions are missing, such as a simple String.trim() function.
A lot of prototyping toolkits exist, with Prototype (yeah, they stole the name) being the most popular one, but at 92KB, some consider Prototype a bit heavy for what they need. If you happen to be one of those people, then you may be interested in picking and choosing prototype methods from the following two resources.
The first is Svend Tofte’s Usefull Prototype Methods for JavaScript (sic). Svend’s collection of a dozen methods weighs in at a tiny 2KB, and it’s all modular enough that you can pick and choose the methods you like the most.
The second is Henlock’s Ten JavaScript Tools Everyone Should Have. I find his methods to be a bit more useful than Svend’s, and he mentions a few additional resources at the bottom of his page.
So what prototype methods are a must for you?
Post a Comment
You must be logged in to post a comment.