Instantiate Classes

Here is the Note class again:

class Note {
  constructor(content) {
    this.text = content;
  }

  print() {
    console.log(this.text);
  }
}

const myNote = new Note("This is my first note!");

console.log(typeof Note);
console.log(typeof myNote);
console.log(myNote instanceof Note);
console.log(myNote);

Notice the typeof Note specifies that Note is a function!

JavaScript's class is syntactic sugar; under the hood, it is a well-crafted function that generates objects for us.

A class must be instantiated (with the new keyword) one or more times, to create objects that you can use in the program.