How to implement interface in javascript [duplicate]
First of all, there is not built in support for traditional abstraction in JavaScript. At least, there are not any types like interfaces and abstract classes. However, interface can be implemented using Object.create method and prototypes. For more information, visit here.
Quoting from an article written by Mark McDonnell:
In JavaScript there are no true "classic" Object-Oriented features, but through clever usage of the language you can emulate an Interface for use with a JavaScript API.
See the following for the complete article:
http://www.javascriptbank.com/how-implement-interfaces-in-javascript.html