Defining methods on a class

Classes that hold values are not particularly interesting. We also want them to be able to have some behaviors that act as interfaces to the outside world. In this recipe, we'll see how to add methods to a class.

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.