Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

10. Making JavaScript Easier with Libraries > JavaScript Library Basics

JavaScript Library Basics

A JavaScript library is a collection of functions and methods presented in a reusable format. Libraries can be a set of personal assets and functions that you build for an individual project or, more commonly, a set of assets and functions. They are carried from project to project to help reduce development time by saving and reapplying the common coding patterns over and over.

You may not have noticed it, but we have been building a sort of custom JavaScript library throughout this book. I’ll admit that it is an extremely small library, but anytime you write a flexible function or method, you have the ability to reuse it beyond the scope of the current project. The ajaxCall() function from Chapter 8, “Communicating with the Server Through Ajax,” is a great example of the kind of asset you would find built into a library because it was built in a very flexible manner and is easily reused with any local JSON data file. In fact, that’s how many of the original JavaScript libraries started. There was a single person collecting frequently used functions who then gave them out for the world to use.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint