CHAPTER 4Libraries

JavaScript libraries have been around in one form or another for almost as long as JavaScript itself. As you go from project to project, it's inevitable that you'll find yourself reusing various functions. They become part of your core that you end up copying each time you start up something new. With any good library, code reuse leads to reliability; using the same code on multiple projects means that the code has been exposed to more and more people, enabling bugs or cross-browser issues to be resolved.

You can, of course, use someone else's library. Using an existing library such as Prototype or jQuery gives you a higher level of reliability that might be difficult to attain through maintaining your own code base.

The trade-off ...

Get Accelerated DOM Scripting with Ajax, APIs, and Libraries now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.