Summary

In Chapter 2, Primitive Data Types, Arrays, Loops, and Conditions, you saw that there are five primitive data types (number, string, Boolean, null, and undefined) and we also said that everything that is not a primitive piece of data is an object. Now you also know that:

  • Objects are like arrays, but you specify the keys.
  • Objects contain properties.
  • Properties can be functions (functions are data; remember var f = function () {};). Properties that are functions are also called methods.
  • Arrays are actually objects with predefined numeric properties and an auto-incrementing length property.
  • Array objects have a number of convenient methods (such as sort() or slice()).
  • Functions are also objects and they have properties (such as length and prototype ...

Get JavaScript : Object-Oriented Programming 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.