This
In programming languages like C# and Java, 'this' keyword represents the current instance of the class, and it is only relevant within the class. JavaScript also has 'this' keyword. However, 'this' keyword in JavaScript behaves differently from other programming languages. For example, in JavaScript, you can use 'this' keyword in the global and function contexts. Moreover, the behavior of 'this' keyword changes between strict and non-strict modes. In JavaScript this always refers to the “owner” of the function we're executing, or rather, to the object that a function is a method of.This :: class
let car = {
brand: 'Honda',
getBrand: function () {
return this.brand;
}
}
console.log(car.getBrand()); // Honda
This :: global
console.log(this === window); // true
this.color= 'Red';
console.log(window.color); // 'Red'
Ginger CMS
the future of cms, a simple and intuitive content management system ... ASP.NET MVC Application
best practices like Repository, LINQ, Dapper, Domain objects ... CFTurbine
cf prototyping engine, generates boilerplate code and views ... Search Engine LITE
create your own custom search engine for your web site ... JRun monitor
monitors the memory footprint of JRun engine and auto-restarts a hung engine ... Validation Library
complete validation library for your web forms ...
the future of cms, a simple and intuitive content management system ... ASP.NET MVC Application
best practices like Repository, LINQ, Dapper, Domain objects ... CFTurbine
cf prototyping engine, generates boilerplate code and views ... Search Engine LITE
create your own custom search engine for your web site ... JRun monitor
monitors the memory footprint of JRun engine and auto-restarts a hung engine ... Validation Library
complete validation library for your web forms ...