define a class

PHOTO EMBED

Wed Apr 05 2023 16:11:13 GMT+0000 (Coordinated Universal Time)

Saved by @azcraze #javascript #class #generate #constructor #this

class Pencil {
  constructor(price) {
    this.price = price;
  }

  isExpensive() {
    return this.price >= 10;
  }
}

//usage
const bic = new Pencil(3);
bic.isExpensive();
content_copyCOPY

https://codetogo.io/how-to-define-a-class-in-javascript/