O'Reilly logo

Get Programming with JavaScript Next: New features of ECMAScript 2015, 2016, and beyond by JD Isaacks

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Unit 6. Classes

JavaScript is an object-oriented language. Except for a few primitives, most values in JavaScript, even functions, are objects. Most of the JavaScript code that gets written is for creating custom objects. Many times you’re probably building your own objects from scratch, but sometimes you’ll be starting from a base object provided from a framework or library and adding custom functionality to it. Unfortunately, there hasn’t been a clear way for library authors to provide a base object prototype that can be extended by application developers. This has left many library authors needing to reinvent the wheel.

But nobody reinvents the wheel the same way. Here’s how Backbone.js provides a way to extend base objects:

Backbone.Model.extend({ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required