Class

noun

say it: “KLASS” /klæs/

A blueprint for making objects of one kind, with a constructor that fills in each new object and methods they all share.

What is Class in JavaScript?

Class — A blueprint for making objects that bundle data with actions.

class Book {
    constructor(title) {
        this.title = title;
    }
}

const guide = new Book("JavaScript");

In a sentence

  • “I wrote a Pet class once, then made Mochi, Biscuit and Juniper from it with new Pet().”
  • “The Ship class let me build ten ships, each with its own name and shields.”

Level: Journeyman · More JavaScript terms at this level

Updated

In other subjects