Book Image

Object-Oriented JavaScript - Third Edition

By : Ved Antani, Stoyan STEFANOV
5 (1)
Book Image

Object-Oriented JavaScript - Third Edition

5 (1)
By: Ved Antani, Stoyan STEFANOV

Overview of this book

JavaScript is an object-oriented programming language that is used for website development. Web pages developed today currently follow a paradigm that has three clearly distinguishable parts: content (HTML), presentation (CSS), and behavior (JavaScript). JavaScript is one important pillar in this paradigm, and is responsible for the running of the web pages. This book will take your JavaScript skills to a new level of sophistication and get you prepared for your journey through professional web development. Updated for ES6, this book covers everything you will need to unleash the power of object-oriented programming in JavaScript while building professional web applications. The book begins with the basics of object-oriented programming in JavaScript and then gradually progresses to cover functions, objects, and prototypes, and how these concepts can be used to make your programs cleaner, more maintainable, faster, and compatible with other programs/libraries. By the end of the book, you will have learned how to incorporate object-oriented programming in your web development workflow to build professional JavaScript applications.
Table of Contents (25 chapters)
Object-Oriented JavaScript - Third Edition
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
Built-in Functions
Regular Expressions

OOP summary


Here's a quick table summarizing the concepts discussed so far:

Feature

Illustrates concept

Bob is a man (an object).

Objects

Bob's date of birth is June 1, 1980, gender - male, and hair - black.

Properties

Bob can eat, sleep, drink, dream, talk, and calculate his own age.

Methods

Bob is an instance of the Programmer class.

Class (in classical OOP)

Bob is based on another object called Programmer.

Prototype

(in prototypal OOP)

Bob holds data, such as birth_date, and methods that work with the data, such as calculateAge().

Encapsulation

You don't need to know how the calculation method works internally. The object might have some private data, such as the number of days in February in a leap year. You don't know, nor do you want to know.

Information hiding

Bob is part of a WebDevTeam object together with Jill, a Designer object, and Jack, a ProjectManager object.

Aggregation and composition

Designer, ProjectManager, and Programmer are all based on and extend a Person object.

Inheritance

You can call the methods Bob.talk(), Jill.talk(), and Jack.talk(), and they'll all work fine, albeit producing different results. Bob will probably talk more about performance, Jill about beauty, and Jack about deadlines. Each object inherited the method talk from Person and customized it.

Polymorphism and method overriding