Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

this js

let user = {
  name: "John",
  age: 30,

  sayHi() {
    // "this" is the "current object"
    alert(this.name);
  }

};

user.sayHi(); // John
Source by javascript.info #
 
PREVIOUS NEXT
Tagged: #js
ADD COMMENT
Topic
Name
3+8 =