paint-brush
Understanding the Magic of 'this' in JavaScriptby@smpnjn
275 reads

Understanding the Magic of 'this' in JavaScript

by Johnny Simpson8mMarch 19th, 2022
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

In Javascript, 'this' is a keyword in Javascript which refers to a property or set of properties within a certain context. In the global context, this refers to the global object - which in the browser is window, but is globalThis in Node.JS and other implementations of Javascript. In strict mode, this inside a function is undefined, but in other places, this means different things. It works differently depending on if you are using strict mode or not - so it's important you do some tests before changing your code.

Company Mentioned

Mention Thumbnail
featured image - Understanding the Magic of 'this' in JavaScript
Johnny Simpson HackerNoon profile picture
Johnny Simpson

Johnny Simpson

@smpnjn

Product, Engineering, Web

About @smpnjn
LEARN MORE ABOUT @SMPNJN'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Johnny Simpson HackerNoon profile picture
Johnny Simpson@smpnjn
Product, Engineering, Web

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite