Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js basic user class

class User {

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

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

}

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

js basic user class

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

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

PREVIOUS NEXT
Code Example
Javascript :: Disable/remove pagination from react material-table 
Javascript :: how to add element to an object 
Javascript :: google jquery 3.5.1 
Javascript :: create secure jwt secret key using node crypto 
Javascript :: what are json files for 
Javascript :: NaN 
Javascript :: array of arrays to one array js 
Javascript :: validate email or phone js 
Javascript :: vue js datetime convert 
Javascript :: react time input 
Javascript :: React-redux and redux 
Javascript :: node check if internet 
Javascript :: javascript Using splice() to Remove Elements 
Javascript :: hello world program in javascript 
Javascript :: Date object for local time and date 
Javascript :: dispatch two actions in redux 
Javascript :: Prevent default event behavior 
Javascript :: code for javascript message box 
Javascript :: how to change test colo on js button 
Javascript :: js nuxt read/set cookie 
Javascript :: js var vs let 
Javascript :: wait for 1 second in loop in javascript 
Javascript :: firebase.apps.length 
Javascript :: getting data from an api 
Javascript :: global variable vuejs 
Javascript :: buffer nodejs 
Javascript :: angular http get status code 
Javascript :: line separator with text in the center react native 
Javascript :: express return svg 
Javascript :: annotation 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =