---
title: "Comment by Juan on \"JavaScript: this is easy and what do you need to know about it!\" | Hashnode"
description: "Hello, I'm learning Javascript from internet and searching answers for knowing how 'this' works in arrow and normal functions get your amazing posts. It all was"
url: "https://hashnode.com/posts/javascript-this-is-easy-and-what-do-you-need-to-know-about-it/5f02b234b0b5c3083fffabac/comment/66122211ab26ee37bda55d68"
---

[Discussion](https://hashnode.com/posts/javascript-this-is-easy-and-what-do-you-need-to-know-about-it/5f02b234b0b5c3083fffabac)

Comment [JavaScript: this is easy and what do you need to know about it!](https://hashnode.com/posts/javascript-this-is-easy-and-what-do-you-need-to-know-about-it/5f02b234b0b5c3083fffabac)

[Juan](https://hashnode.com/@juan491)

[Apr 7, 2024](https://hashnode.com/posts/javascript-this-is-easy-and-what-do-you-need-to-know-about-it/5f02b234b0b5c3083fffabac/comment/66122211ab26ee37bda55d68)

Hello, I'm learning Javascript from internet and searching answers for knowing how 'this' works in arrow and normal functions get your amazing posts. It all was fine until I get the following part : "What do you think, this would be bound to here inside forEach? It is not an arrow function. It is a regular function, and it has its own execution context. In that execution context, there is nothing called a name. Hence this.name is undefined." Because of in your previous post about binding, the object on which the function is called define the binding of 'this'. So I don't understand which is the Object on which the anonymous function (inside of forEach) is called in this case. It would be good identify that in order to follow the thread of the previous explanations. I am aware of this is 4 year old, and maybe you are in other business, but I get here today and write this question just in any case. Thanks.

[Juan](https://hashnode.com/@juan491)

[Apr 7, 2024](https://hashnode.com/posts/javascript-this-is-easy-and-what-do-you-need-to-know-about-it/5f02b234b0b5c3083fffabac/comment/66122211ab26ee37bda55d68#reply-6612d030c32a88e015356bbf)

Well, I was doing more things to get clarify the 'this' unclear, in the example code from your post:

////////////////////////////////////////////////////

var testHobbies = { hobbies: \['Cricket', 'Football', 'Blogging'\], name: 'Alex', logHobbies() { this.hobbies.forEach(function(elem){ console.log(`${this.name} knows ${elem}`); }); } } ////////////////////////////////////////////////////////

So, changing in the code 'this.name' by only 'this' when it runs result the following output;

\[object global\] knows Cricket \[object global\] knows Football \[object global\] knows Blogging

Then taking from your explanation on the Binging part: "if the this keyword is not resolved with any of the above bindings, implicit, explicit or new then, the this binds to the window(global) object."

So in the example code above, the 'this' inside the anonymous function binds to object global, because 'this' keyword is not resolved with any of bindings: implicit, explict or new, and also it doesn't exist in its function context. That is what I understand until here.
