Skip to content

Commit 0e10d34

Browse files
feat: add this keyword
1 parent c778b31 commit 0e10d34

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
🔹 3. this keyword
3+
✅ What is this?
4+
this refers to the object that is executing the current function.
5+
💡 Rule of Thumb:
6+
Context this refers to
7+
In a method: The object that owns the method
8+
Alone (non-strict): Global object (window)
9+
Alone (strict): undefined
10+
Inside an arrow function Inherits this from the surrounding lexical scope
11+
In event listener The element that received the event
12+
In constructor The newly created object
13+
*/

0 commit comments

Comments
 (0)