Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js basic user class

class User {

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

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

}

// Usage:
let user = new User("John");
user.sayHi();
Source by javascript.info #
 
PREVIOUS NEXT
Tagged: #js #basic #user #class
ADD COMMENT
Topic
Name
4+8 =