12. Libraries

Throughout this book you’ve seen helper functions for strings, arrays, elements, and events. You may want to use these or similar functions in your code. And when you start your second project, you may decide to copy much of this code over so you don’t have to start from scratch. Ta-da! You’ve created a library!

The most important reason for using a library is to avoid reinventing the wheel for each project. JavaScript has a relatively small set of built-in functions, so collections of reusable code can be great time-savers.

JavaScript programmers also spend much of their time dealing with the differences between browsers, especially between Internet Explorer and all the other modern browsers like Firefox and Chrome. Sometimes ...

Get The JavaScript PocketGuide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.