Backbone provides a convenient extend method to create child classes. That is to say, class inheritance is implemented in JS. The source code is easy to understand and will not be listed here. I believe everyone can understand it.
Model. extend = Collection. extend = Router. extend = View. extend = History. extend = extend;
By providing the on-site code, we can know that all the Model View Collection Router History objects in Backbone have extend methods. Therefore, the subclass they create also has the extend method.
Summary
Backbone can be said to be a lightweight JavaScript framework. The source code contains more than 1600 lines, but the function is indeed very powerful. At present, the more users there are, especially in the web app era, I believe that you will surely get an unexpected coding pleasure. Thanks to the authors of Backbone for offering us such a good thing!