---
title: "5 Rules to master ‘this’ in Javascript"
url: https://daily.dev/posts/5-rules-to-master-this-in-javascript-bt8srln9
source_url: https://blog.tusharcodes.tech/5-rules-to-master-this-in-javascript
type: article
source: "Hashnode"
author: "Tushar Tiwari"
published: 2022-05-11T12:22:41.183Z
updated: 2022-05-11T12:22:41.184Z
tags: ["javascript"]
reading_time: 4
upvotes: 58
comments: 2
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# 5 Rules to master ‘this’ in Javascript

**[Hashnode](https://daily.dev/sources/hashnode)** · [@tushartiwari](https://daily.dev/tushartiwari) · 4 min read · 58 upvotes · 2 comments

## Summary

The value of this will be determined by the block from where it gets called, but in an order of precedence that we'll discuss here. Invoking Function with a new keyword, the this inside function will refer to a new empty object. Free Function Invocation means calling the function without any of the conditions discussed above (without using new operator, or as a method belonging to an object)

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.tusharcodes.tech/5-rules-to-master-this-in-javascript>

## Community discussion

Top comments from developers on daily.dev.

**@raulmarindev** · 0 upvotes

> Concise and well explained. Bookmarked!

**@tushartiwari** · 0 upvotes

> Thank you

## Similar posts on daily.dev

- [Don’t just attend KubeCon \+ CloudNativeCon, Merge Forward your experience\!](https://daily.dev/posts/don-t-just-attend-kubecon-cloudnativecon-merge-forward-your-experience--l0rpp73x8) · CNCF · 0 upvotes · 0 comments
- [Announcing H2 2026 KCDs](https://daily.dev/posts/announcing-h2-2026-kcds-m96goajm1) · CNCF · 1 upvotes · 0 comments
- [Two months of Open Community Groups](https://daily.dev/posts/two-months-of-open-community-groups-asf52zhbs) · CNCF · 0 upvotes · 0 comments
- [CNCF Unveils Schedule for KubeCon \+ CloudNativeCon Europe 2026](https://daily.dev/posts/cncf-unveils-schedule-for-kubecon-cloudnativecon-europe-2026-ikhcoa5cb) · CNCF · 2 upvotes · 0 comments
- [CNCF Debuts KubeCon \+ CloudNativeCon Japan 2026 Schedule](https://daily.dev/posts/cncf-debuts-kubecon-cloudnativecon-japan-2026-schedule-xp5pyudub) · CNCF · 1 upvotes · 0 comments

---

Tags: [#javascript](https://daily.dev/tags/javascript)

[View this post on daily.dev](https://daily.dev/posts/5-rules-to-master-this-in-javascript-bt8srln9)
