r/learnjavascript • u/fa_foon • Mar 30 '26
question about `this.`
i understand that `this` refers to the caller of the function so how can `name` in `function Person(name){this.name = name;}` be assigned to `Person` since no object is calling
(this wasn't explained in that comment )
9
Upvotes
View all comments
Show parent comment
1
u/azhder Apr 02 '26
Best not discuss exceptions like that, but the general rule that with
.call()and.apply()you can specify what thethisis and say that’s going on with Event handlers under the hood