In JavaScript, every object has a link to its constructor (the function that was used to create the object). It is available as obj.constructor .
If you have a Backbone.js model that is extended with Backbone.Model this way: var YourModel = Backbone.Model.extend({}); , you can create an object using new : var yourModel = new YourModel(); .
Then you can use yourModel.constructor :
yourModel.constructor === YourModel // true
Or instanceof :
yourModel instanceof YourModel // true yourModel instanceof Backbone.Model // true
source share