Abstract
As with ABAP, JavaScript allows you to create objects. However, the concepts pertaining to object creation in the two languages are not the same. This chapter covers object creation, instantiation, and inheritance in JS. After starting with an overview of object-oriented programming (OOP) in general, the rest of the chapter shows how OOP is implemented in JS, along with relevant syntax. It introduces the this operator in detail, then covers the various ways of creating objects, followed by the instantiation steps using the new keyword. Once you have a basic understanding of objects, the chapter moves on to inheritance as implemented in JS using prototypes. This chapter presents real-life examples of objects and subobjects throughout, along with sample code listings used for implementing them in JavaScript.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2017 Rehan Zaidi
About this chapter
Cite this chapter
Zaidi, R. (2017). Object-Oriented Programming in JavaScript. In: JavaScript Essentials for SAP ABAP Developers. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-2220-1_8
Download citation
DOI: https://doi.org/10.1007/978-1-4842-2220-1_8
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-2219-5
Online ISBN: 978-1-4842-2220-1
eBook Packages: Professional and Applied ComputingProfessional and Applied Computing (R0)Apress Access Books