showing results for - "this javascript"
Roman
08 Apr 2019
1// this = current execution context (window in browser, global in nodejs)
2console.log(this) // window object
3
4function foo () {
5 console.log(this); // object calling this function
6}
7
8foo(); // undefined
9
10o={ foo }
11o.foo(); // 'o' object logged
Christopher
27 Oct 2017
1var wF = {
2    w : 560,
3    h : function() { return (312 - 42) / (560 / this.w) + 42; }
4};
5
6alert(wF.h())
7
Luca
11 Jan 2020
1var colours = ['red', 'green', 'blue'];
2document.getElementById('element').addEventListener('click', function() {
3    // this is a reference to the element clicked on
4
5    var that = this;
6
7    colours.forEach(function() {
8        // this is undefined
9        // that is a reference to the element clicked on
10    });
11});
12
Paulina
10 Feb 2017
1
2"use strict";
3function myFunction() {
4
5    return this;
6
7}
8 
Anaelle
20 Sep 2016
1In regular functions the this keyword represented the object that called the function, which could be the window, the document, a button or whatever.
2
3With arrow functions, the this keyword always represents the object that defined the arrow function.
Lorenzo
25 Sep 2017
1// Im Webbrowser ist das window Objekt das globale Objekt:
2console.log(this === window); // true
3
4a = 37;
5console.log(window.a); // 37
6
7this.b = "MDN";
8console.log(window.b);  // "MDN"
9console.log(b);         // "MDN"
10
queries leading to this page
how to use this in jsthis w javascriptwhen use javascript thisusing this keyword in javascriptwhat is the this keyword in javascriptusing this keyword in javascript functionjs function thiswhat is that 3d this javascriptavascript this keyword this javascript 3f what is this in javascriptthis keyword in javascript functionis there this in jsthis jstthiskeyword in javascriptthis in javascript objectis this a js keywordjavascript this in functionthis javascpritjs what is thishow to use this in js 3f 24 is this in jsjs in objectthis en jsthis 5b 5d in javascript 3c this javascriptjavascript keyword thisjs this what is do you need the this keyword in javascriptwhat is this keyword in jsjs this 5b 5dthis method javascriptjs 3f in objectjavascript this 23this inside a object 3a 3athis jsfunction this javascriptjavascript this inside functionthis object javascriptjavascript the this keywordthis property javascriptthiss in javascripthow does 22this 22 work in javascriptfive ways this keyword javascriptthis in javascript definitionwhat 27s this in javascripthow to use 22this 22 when you in a function javascripthow to use this in javascriptjavascript is in objectthis in javascri 5btthis in js 3d 3e this in javascriptthis keyword in jsthis keyword javascipt this in js functionthat this javascriptfunction 28this 29 in javascriptjavascript 3a thiswhy use the this keyword javascriptthis keyword javascript functionjs 28this 2c function 29when to use this keyword in javascriptthis in objectwhat does the this keyword do in javascript 3fthis in javascriptjs 3f in object 24 this in jsthis javascript in functionthis 28 29 in javascriptthe javascript this keyword refers to the object it belongs to 22 24this 22 in javascript this 2b javascript 22 3f 22 what is this in javascript 21 21this en javascriptjavascript this keyword explainedwhat is this 28 29 in jsthis in javascript functionthis 3d 27 27 jsdefine this in javascriptusing this in an object javascriptjavascript this 5b 5dthis keyword di javascriptwhy use this keyword in javascriptobject javascript this 3f in object javascriptthis explained javascriptwhat is the functionality of the keyword this in javascriptwhat is this jswhat is 27this 27 in javascript 3fthis javasciptof 22this 22 keyword in js 24this jsthis keyword with javascripthow to get this javascriptthis javascriptthis in jswhat is this in javascript 24this 3d 24 28this 29 javascriptjavascript this 3fthis inside an object jsjs set keyword thisthis this 3d this javascriptthis in javascrpit 3f in object jsthis keyword injavascriptjavascript htis 22this 22 syntax jswhat is this in jsthis keyword javascritpwhat is this keyword in javascriptjs function thisjavascript thisthis keyword javascripytthis in objects jsusing this in function javascriptjs this thisthis object in javascriptwhat does this in javascript 24 28this 29 in jsthis meaning jsthis explained i javascritjavascript thiswhat is javascript thisusing the this keyword in javascriptthis for object javascriptthis 5b 5d jsjavascript what is thisthis 24 javascriptthe keyword this javascriptjs this thatget 22this 22 in javascipt 24this in javascriptkeyword this javascriptobject this javascriptthis 3d that jsthis 3d 7b 7d jsthis jsthis 28 29 in object javascript 22this 5b 5d 22javascriptthis value javascript 24 28this 29 jsjavascript 24thisthis keyword in javascript objectthis 28 29 javascriptthis not working in object 24 28this 29 in javascriptwhen do we use this in javascripthow this keyword works in javascriptthis is jsthis keyword use i jsfunction this in javascriptexplain how this works in javascriptthis keyword in jvascriptwhat is this javascriptthis nedir jshow to define this in javascriptjs that keywordjavascript thisjavascript this keywordthis in object javascirpt 22js this 22js object this this keyword in js objectthis keyword javascirptthis javascriptjavascript this methodjs 24 28thus 29using this in javascriptjava script this keywordjavascript 3d thiswhat does this mean jsthis that javasciptthis in function jsuse this in object jsuse this inside object jsjs this in object methodjavascript this function 24 this jswhat is 27this 27 in javascriptthe this keyword in javascriptthis keyword js e2 80 98this e2 80 99 keyword in javascript 3fthis keyword in function javascriptjs keyword thisthis jshow to use 24this in jsthis keyword in javascript es6this keyword in javascript meansjavascript this thatthis keyword in javascript codejs this 28 29that 3d this jsthis keyword javascrpit 24 28this 29 javascript 28 29 3d what is this in javascriptjavascript this 22 22this keyword in javascriptnode js this keywordjs 24thiswhen used inside of an object 2c this refers tojavascript this 3d thathow to use this keyword in javascriptjavascript this 2cthis keyword in javascriptkeyword this in javascriptthis keyword jsjavascript object thisthis and that in javascriptwhat does the this keyword do in javascriptthis jaswhat is e2 80 98this e2 80 99 keyword in javascript 3f javascript thisthis in javascriptjavascript 24 28this 29this in function javascriptthis keyword in object javascriptthis keyword in class in jsthis js functionthis definition in javascript 21 21this jsjs 2bthisthis in javascriptthis 3d that javascriptthis in jasthis in js objectjs this this keyword in javascriptsthis definition javascriptthis javascript explainedjavasript thisthis in method javascriptwhy this inside object that is inside another object points to window this in javasccriptjavascript this 3f this in javascriptthis javascripotusing this in function jswhat is 22this 22 in javascript 2cthis in javvascriptjs with thisjavascript that 3d thisjavscript this 3djs 22this 22javascript 3d this or thatjavascript that keywordthis in jsthis javascriptthis statement javascriptuse this in object javascriptwhat is 24 28this 29 in javascript 21this jsthat 3d this javascriptjavascript this explainedjavascrip this 3d thatwhy change this 3b this in jsthis this javascript this in javascriptthis keyword in functionhow to use this javascriptthis in objectjavasciptthis 27 keyword in javascriptthis keyword in jasthis in a javascript functionwhat is this in javascript this in jsjs this in object 24this javascriptthis in object javascriptjavascript this objshould i use this in javascriptwhat is 3f in object javascript this in object javasciptusing this in function in javascritall about this keyword in javascriptin js using thiswhat is this in javascriptjavascript this method thisthis in javascritpjs this this jsthis javascript 27javascript this refers to windowthis keyword in node jsthis jjs this 23the javascript 22this 22 keywordthis keyword in jsthis keyword in javascript with example 22this 22 jsusing this in objectthis in this js 21 21this javascriptthis meaning javascriptjavascript this in a object functionthis injsthis 3ci 3e javascriptthat 3dthis javascripthow to use this jsjs this keywordjs this in function this javascriptwhat is 22this 22 in js 3fthis in javascript explainedin objectthis keyword explained javascriptjavascript this in objectkeyword this in jsthis javasriptwhat does this keyword do in javascriptthis in object jsthis in jsusing this is javascriptthis 29 in object javascriptthis function jsthis jsusing this in jsthe this in jsjava script thiswhat is 27this 27 keyword in javascript 3fthis is javascriptjs 22 22 in objectthis 2fthat jsthis keyword in javascript examplesjavascript this and thatthis jsjavascript use this in objectthis en javascriptthe keyword this in javascriptthis in a function javascriptthis in objects javascriptthis javascriptjs that 3d thisjavascript this thiswhat is javascript this keywordthis 28 29 in jshow to use the this keyword in javascriptthis word in javascriptthis keyword in javascroptcurrent method javascriptwhat does this in jsjs this 24js 23thisthis in java script 28this 29 javascriptthis javascript keyword e2 80 9cthis e2 80 9d in javascript 21this javascriptthis keyword javascriptwhy we use this in javascriptfunction in object thisthis javascript