# This in javascript

**URL:** <https://forum.codewithmosh.com/t/this-in-javascript/11390>\
**Category:** JavaScript\
**Created:** [March 20, 2022, 7:02pm UTC](https://forum.codewithmosh.com/t/this-in-javascript/11390 "2022-03-20T19:02:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abidali.qutbuddin](https://avatars.discourse-cdn.com/v4/letter/a/9f8e36/32.png) [@abidali.qutbuddin](https://forum.codewithmosh.com/u/abidali.qutbuddin)\
**Post date:** [March 20, 2022, 7:02pm UTC](https://forum.codewithmosh.com/t/this-in-javascript/11390/1 "2022-03-20T19:02:31Z")

</div>

Hi Mosh,  
I hope you are great!

I am writing this below code in the browser console,

> const person = {
> 
> talk() {
> 
> ```
> console.log(this);
> 
> ```
> 
> },
> 
> };
> 
> person.talk();

```auto
the above code is not returning the reference to the object but when i write person.talk, it returns it.

I don`t know how you are getting the results in tutorial while writing the above code.
Please correct me what is wrong here. thanks.
```

---

<div class="post-metadata">

**Author:** ![eelsholz](https://avatars.discourse-cdn.com/v4/letter/e/439d5e/32.png) [@eelsholz](https://forum.codewithmosh.com/u/eelsholz)\
**Post date:** [March 21, 2022, 12:20am UTC](https://forum.codewithmosh.com/t/this-in-javascript/11390/2 "2022-03-21T00:20:00Z")

</div>

`person` is the reference to the object. `person.talk()` calls the `talk` method, which logs the object to the console. It seems to be working okay to me. What are you expecting it to do instead?
