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

2. Working with Objects and Properties > Enhancing and Extending Objects with U...

Enhancing and Extending Objects with Underscore.js

JavaScript 1.5 is lacking when it comes time to seriously manipulate and manage objects. If you are running JavaScript in a web browser, I would like to be bold here and suggest the usage of Underscore.js when you need more functionality than is provided by JavaScript 1.5. Underscore.js provides the following functionality when dealing with objects.

These functions work on all objects and arrays:

  • each()

  • map()

  • reduce()

  • reduceRight()

  • detect()

  • select()

  • reject()

  • all()

  • any()

  • include()

  • invoke()

  • pluck()

  • max()

  • min()

  • sortBy()

  • sortIndex()

  • toArray()

  • size()

These functions work on all objects:

  • keys()

  • values()

  • functions()

  • extend()

  • clone()

  • tap()

  • isEqual()

  • isEmpty()

  • isElement()


  

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