O'Reilly logo

JavaScript™ Phrasebook: Essential Code and Commands by Christian Wenz

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

Chapter 6. OOP and Events

The more advanced JavaScript applications get, the greater is the need for structuring the code well. One way to do so is by using OOP, object-oriented programming. JavaScript itself is not an object-oriented language, but rather an object-based language. So there is a support for OOP, though it’s somewhat limited.

The second topic of this chapter is the general JavaScript event handling. Apart from the basics, special events (mouse and keyboard) are covered.

Creating a Class

Example . 

function UniversalClass() { }

There is no distinctive keyword for classes in JavaScript. Instead, each class is defined as a function. The difference between a regular function and this one is the way this function is later called: with the ...

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