Chapter 4Object-Oriented Programming

Objects

Object-oriented concepts are everywhere in modern programming. If you have worked with .NET (C# or VB .NET), C++, or Java, then you should already be familiar with objects and object-oriented programming. If you are not, then this chapter will both introduce you to that topic conceptually and show you how to use it in JavaScript.

An object is a programming abstraction that groups data with the code that operates on it. All programs contain data of different types. Variables, as well as functions, were introduced separately in the previous chapter. I defined functions, and I defined variables, but I did not connect them in any way. An object encapsulates related data and functions into a single cohesive ...

Get Advanced Javascript, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.