use of this keyword in js
// In web browsers, the window object is also the global object:
console.log(this === window); // true
a = 37;
console.log(window.a); // 37
this.b = "MDN";
console.log(window.b) // "MDN"
console.log(b) // "MDN"
The JavaScript this keyword refers to the object it belongs to.
It has different values depending on where it is used: In a method,
this refers to the owner object. Alone, this refers to the global
object.// In web browsers, the window object is also the global object:
console.log(this === window); // true
a = 37;
console.log(window.a); // 37
this.b = "MDN";
console.log(window.b) // "MDN"
console.log(b) // "MDN"
Also in JavaScript:
- remove whitespace javascript
- how to delete cookie node js
- onload fetch data using ajax laravel
- anonymous functions javascript
- comprimento string javascript
- navigation.openDrawer is not a function react native
- sars
- js this in object
- The missing value javascript
- location.reload sweetalert
- post method javascript code
- json decode android
- loopback merge data and update
- ApexCharts
- save sort order of jquery sortable
- belle delphine
- javascript change url
- angular get current time
- javascript base64url decode
- java serialize object to json
- simple email validation in javascript
- google login with react native
- (click)="onProductSelect(item.id)"
- javascript if statement and