“JS Basic User Class” Code-Antworten

JS Basic User Class

class User {

  constructor(name) {
    this.name = name;
  }

  sayHi() {
    alert(this.name);
  }

}

// Usage:
let user = new User("John");
user.sayHi();
Puzzled Puffin

JS Basic User Class

class User {
  constructor(name) { this.name = name; }
  sayHi() { alert(this.name); }
}

// proof: User is a function
alert(typeof User); // function
Puzzled Puffin

Ähnliche Antworten wie “JS Basic User Class”

Fragen ähnlich wie “JS Basic User Class”

Weitere verwandte Antworten zu “JS Basic User Class” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen