How it works...

The classRocket {} syntax is the equivalent to creating a function named Rocket (notice the constructor value of the logged object). This means that, in JavaScript, instances of Rocket can be created with the new operator. This creates an object based on the prototype.

We'll see how to make some more interesting objects in future recipes.

Get ECMAScript Cookbook 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.