---
title: "Discussion on \"5 Rules to master ‘this’ in Javascript\" | Hashnode"
description: "Discussion on \"5 Rules to master ‘this’ in Javascript\". Few Set of Rules to find out what will 'this' refer to at any point in javascript"
url: "https://hashnode.com/posts/5-rules-to-master-this-in-javascript/627b58dc983a4ab69ce9c093"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [5 Rules to master ‘this’ in Javascript](https://tushartiwari.hashnode.dev/5-rules-to-master-this-in-javascript?utm_source=hashnode&utm_medium=feed)

Few Set of Rules to find out what will 'this' refer to at any point in javascript

May 11, 2022 · 5 min read · tushartiwari.hashnode.dev  
Updated May 13, 2022  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#thw-web-apps](https://hashnode.com/tag/thw-web-apps)

## Written by

[Tushar Tiwari](https://hashnode.com/@tushartiwari)

@tushartiwari · Chandigarh

  
[View profile](https://hashnode.com/@tushartiwari)

All Things Web | Blogs on JavaScript and ReactJs

## Responses 5

Markdown supported · ⌘↵ to post

[Ankit Singh](https://hashnode.com/@ankit9761)

[Jun 1, 2022](https://hashnode.com/posts/5-rules-to-master-this-in-javascript/627b58dc983a4ab69ce9c093/comment/6296da9d8181eeee2a1b3eca)

Great and Very Informative.

[Ashish Kumar](https://hashnode.com/@iamashish759)

[May 12, 2022](https://hashnode.com/posts/5-rules-to-master-this-in-javascript/627b58dc983a4ab69ce9c093/comment/627cf2ab4903bec29b586e1c)

Now i Know This :)

[Tushar Tiwari](https://hashnode.com/@tushartiwari)

[May 12, 2022](https://hashnode.com/posts/5-rules-to-master-this-in-javascript/627b58dc983a4ab69ce9c093/comment/627cf2ab4903bec29b586e1c#reply-627cf6d54903bec29b586efd)

Haha, Glad you got This ;)

[nmhillusion](https://hashnode.com/@nmhillusion)

[May 12, 2022](https://hashnode.com/posts/5-rules-to-master-this-in-javascript/627b58dc983a4ab69ce9c093/comment/627c82b9b7c3c8c34614e9f0)

Maybe an typo error in here:

```
function print() {
 console.log(this);
}
const developer= {
 love: "JavaScript"
};
const bindedFn = print.bind(developer);  // { love: "JavaScript" }
name.call(developer);  // { love: "JavaScript" } // should be bindedFn.call?
name.apply(developer);  // { love: "JavaScript" }
```

`bindedFn` instead of `name`?

[Tushar Tiwari](https://hashnode.com/@tushartiwari)

[May 12, 2022](https://hashnode.com/posts/5-rules-to-master-this-in-javascript/627b58dc983a4ab69ce9c093/comment/627c82b9b7c3c8c34614e9f0#reply-627c8deab7c3c8c34614eafe)

Thankyou for finding it [nmhillusion](https://hashnode.com/@nmhillusion). Yes, it's a typo, there should be `print.call` instead.

[Sruthi](https://hashnode.com/@sruthiragupathy)

[May 11, 2022](https://hashnode.com/posts/5-rules-to-master-this-in-javascript/627b58dc983a4ab69ce9c093/comment/627ba14be525f1b677136a81)

```
const author = {
 awesome: 'tushar',
 print: function() {
     console.log(this);
 },
};
const reader = { awesome: 'me' };

author.print.call(reader);  // { awesome: 'me' }
new author.print() // {}
```

-   Since the **print** method is invoked with **call** , **this** refers to the object that has been passed, i.e, the **reader** object
-   Since the **print** is invoked with **new** keyword, this is a **new empty object**

Well summed btw!!

[Tushar Tiwari](https://hashnode.com/@tushartiwari)

[May 11, 2022](https://hashnode.com/posts/5-rules-to-master-this-in-javascript/627b58dc983a4ab69ce9c093/comment/627ba14be525f1b677136a81#reply-627bc42de525f1b67713707a)

That's Awesome 💛 Thank you for the kind words [Sruthi](https://hashnode.com/@sruthiragupathy)

[Bhakti Kharatkar](https://hashnode.com/@Bhaktee)

[May 11, 2022](https://hashnode.com/posts/5-rules-to-master-this-in-javascript/627b58dc983a4ab69ce9c093/comment/627b6e01983a4ab69ce9c56c)

Well written [Tushar Tiwari](https://hashnode.com/@tushartiwari) 👏

[Tushar Tiwari](https://hashnode.com/@tushartiwari)

[May 12, 2022](https://hashnode.com/posts/5-rules-to-master-this-in-javascript/627b58dc983a4ab69ce9c093/comment/627b6e01983a4ab69ce9c56c#reply-627c8fdd4903bec29b585d41)

Thanks Bhaktee
