Horje
this js Code Example
this js
let user = {
  name: "John",
  age: 30,

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

};

user.sayHi(); // John
this javascript
/*In general, the 'this' references the object of which the function is a property.
In other words, the 'this' references the object that is currently calling the function.
Suppose you have an object called 'counter' that has a method 'next()'.
When you call the 'next()' method, you can access the this object. */

let counter = {
  count: 0,
  next: function () {
    return ++this.count;
  },
};
counter.next(); 
//Inside the next() function, the this references the counter
Code language: JavaScript (javascript)
this javascript
// Im Webbrowser ist das window Objekt das globale Objekt:
console.log(this === window); // true

a = 37;
console.log(window.a); // 37

this.b = "MDN";
console.log(window.b);  // "MDN"
console.log(b);         // "MDN"




Javascript

Related
Heat Map JS Code Example Heat Map JS Code Example
how to get duplicate values from array in javascript Code Example how to get duplicate values from array in javascript Code Example
angular turn text into input Code Example angular turn text into input Code Example
array sort in angular 6 Code Example array sort in angular 6 Code Example
how to read a csv file in nodejs Code Example how to read a csv file in nodejs Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7