Skip to content

Instantly share code, notes, and snippets.

View ziadevcom's full-sized avatar
👨‍💻
Coding...

Zia Ahmad ziadevcom

👨‍💻
Coding...
View GitHub Profile
@ziadevcom
ziadevcom / this keyword javsacript.md
Last active May 3, 2025 08:43
A good explanation on how "this" keyword works in JavaScript

this keyword explanation by u/delventhalz/

This discussion took place in r/learnjavascript on this post


Most explanations for this are I think overly technical. You don't need to know what an "execution context" is in order to understand this. Here is the way to think of it:

  1. It works like a function parameter

  2. Instead of being between the parentheses like other parameters, it is the the thing to the left of the dot