---
title: "What is the difference between a regular function and an arrow function on binding to \"this\"?"  
description: "What is the difference between a regular function and an arrow function on binding to \"this\"?"  
author: "Revati S Misra"  
published: 2023-05-15  
updated: 2023-05-15  
canonical: https://www.mindstick.com/forum/158335/what-is-the-difference-between-a-regular-function-and-an-arrow-function-on-binding-to-this  
category: "javascript"  
tags: ["javascript", "javascript events", "javascript object"]  
reading_time: 2 minutes  

---

# What is the difference between a regular function and an arrow function on binding to "this"?

What is the [difference](https://www.mindstick.com/articles/157114/good-news-or-bad-news-and-the-difference-is) between a [regular](https://www.mindstick.com/forum/220/problem-in-regular-expression-in-javascript) function and an [arrow function](https://www.mindstick.com/forum/160054/how-to-pass-parameter-values-in-javascript-arrow-function) on [binding](https://www.mindstick.com/blog/146/dynamic-binding-in-c-sharp) to "this"?

## Replies

### Reply by Aryan Kumar

The main difference between a regular [function](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server) and an [arrow](https://answers.mindstick.com/qa/95602/which-country-test-flighted-arrow-3-anti-ballistic-missile-system-and-its-interceptors) function is how they bind to the this keyword.

A regular function binds this to the object that it is called on. For example, if you call a regular function from an object, this will refer to that object.

An arrow function, on the other hand, binds this to the value of this at the time the arrow function is defined. This means that an arrow function always has the same value of this, regardless of how it is called.

Here is an example of how regular functions and arrow functions bind to this:

Code snippet

```plaintext
// Regular function
function myFunction() {
  console.log(this);
}

// Arrow function
const myArrowFunction = () => {
  console.log(this);
}

// Call regular function from an object
const obj = {
  myFunction: myFunction
};
obj.myFunction(); // Will log the object

// Call arrow function from an object
obj.myArrowFunction(); // Will log the global object
```

As you can see, the regular function logs the object that it is called on, while the arrow function logs the global object.

This difference in how regular functions and arrow functions bind to this can be important to keep in mind when you are writing JavaScript code.


---

Original Source: https://www.mindstick.com/forum/158335/what-is-the-difference-between-a-regular-function-and-an-arrow-function-on-binding-to-this

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
