Understanding the 'this' Keyword in JavaScript
About this video
Check out this video I made with revid.ai
Try the AI TikTok Video Generator
Create your own version in minutes
Video Transcript
Full text from the video
Ever found yourself scratching your head asking What is this in JavaScript? Youre not alone.
The this keyword is one of the most misunderstood concepts, yet incredibly powerful once you grasp it.
In simple terms, this refers to the object that is currently executing the code. Its value changes
dynamically depending on the context a function is called in. Consider these scenarios.
Globally, this points to the window object in browsers. Inside a regular
function, it can point to the global object unless in strict mode.
When a function is a method of an object, this refers to that parent object.
With the new keyword in a constructor, this points to the newly created instance. Arrow functions
Newest Videos
240,909+ Short Videos
Created By Over 14,258+ Creators
Whether you're sharing personal experiences, teaching moments, or entertainment - we help you tell stories that go viral.