Skip to Content
JavaScript and Open Data
book

JavaScript and Open Data

by Robert Jeansoulin
August 2018
Intermediate to advanced
272 pages
5h 3m
English
Wiley-ISTE
Content preview from JavaScript and Open Data

4Objects and Prototypes

JavaScript distinguishes itself from most usual “object-oriented programming” (OOP) languages, which are “class based”: JavaScript is “prototype based”. This originality is confusing for people accustomed to other OOP languages, and sometimes perceived as a weakness vis-à-vis better “controlled” languages such as Java, of which it “inherited” the name based on a misunderstanding.

4.1. Introduction

This chapter is organized as follows:

  • – an introduction about the notions of “concept” versus “named entities” should help in understanding the difference between “class-based” and “prototype-based” OOP;
  • section 4.2: This section details the syntax and use of the “object literal” in JavaScript, popular through the JSON format, which is widely used to exchange data over the Internet;
  • section 4.3: This section deals with the methods of the built-in objects “Object” and “Object.prototype”, how they provide the notion of inheritance by delegation and how objects can be related;
  • section 4.4: After analyzing the role of prototypes, we detail the three approaches for creating objects:
    • - literal: this includes the operator {..}, the role of the functions Object and Function, to enlighten the role of the “prototypes” in the inheritance mechanism in JavaScript,
    • - prototypal: this includes the innovative methods Object.create and Object.assign (ES6),
    • - classical: this consists of the operator “new” and the “constructor” functions.

We can hardly talk about objects ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Data Wrangling with JavaScript

Data Wrangling with JavaScript

Ashley Davis
Web Applications with Javascript or Java

Web Applications with Javascript or Java

Gerd Wagner, Mircea Diaconescu

Publisher Resources

ISBN: 9781786302045