Monday, 4 Aug 2025
  • My Interests
  • My Saves
  • Try Intents
Subscribe
Focus - Code Reveals
  • Home
  • HTML

    What is the difference between “HTML” and “HTML5”?

    By Chief Editor

    What is a Meta Tag in HTML?

    By Chief Editor

    What is Doctype HTML in HTML?

    By Chief Editor

    What is Block level Element and Inline Level Element?

    By Chief Editor

    Difference between HTML Tag and HTML Element in HTML?

    By Chief Editor

    What are the different types of HTML tags?

    By Chief Editor
  • JavaScript

    Explain var let and const in JavaScript with Example.

    By Chief Editor

    Difference between document.createElement and document.createElementFragement in JavaScript?

    By Chief Editor
    What are the Lexical Scope in JavaScript

    What are the Lexical Scope in JavaScript?

    By Chief Editor

    What is a Closure in JavaScript?

    By Chief Editor

    Explain Call, Apply and Bind in JavaScript.

    By Chief Editor

    What is one-way data binding in React?

    By Chief Editor
  • Frontend Interview

    Is JavaScript a synchronous or asynchronous language?

    By Chief Editor

    What is Symentic HTML?

    By Chief Editor

    What are the Lexical Scope in JavaScript?

    By Chief Editor

    Difference Between position: relative and position: absolute in CSS

    By Chief Editor

    Explain Deep Copy and Shallow Copy in JavaScript.

    By Chief Editor

    How to Reverse a String in JavaScript: Two Essential Methods

    By Chief Editor
  • Backend Interview

    What are the different types of HTML tags?

    By Chief Editor

    What is Life Cycle method in React?

    By Chief Editor

    Mastering Star Rating Systems: Best Practices and Optimized Code Examples

    By Chief Editor

    What is memoization in JavaScript?

    By Chief Editor

    What are the Rest and Spread operators in JavaScript?

    By Chief Editor

    What is Scope in JavaScript?

    By Chief Editor
  • Nodejs
  • JavaScript Interview
  • React Interview
  • Frontend Interview
  • Backend Interview
  • Contact Us
  • Advertise with Us
  • Complaint
  • Cookies Policy
  • Privacy Policy
  • Donate
  • 🔥
  • ReactJS
  • JavaScript
  • JavaScript Interview
  • React Interview
  • HTML
  • Frontend Interview
  • CSS
  • Redux
  • Javascript
  • System Design
Font ResizerAa
Focus - Code RevealsFocus - Code Reveals
  • My Saves
  • My Interests
  • My Feed
  • History
  • Technology
Search
  • Homepage
  • ReactJS
  • JavaScript
  • JavaScript Interview
  • HTML
  • CSS
  • Backend Interview
Have an existing account? Sign In
Follow US
© 2022 Code Reveals Inc. All Rights Reserved.
Home Blog What is Arrow and Normal Function in JavaScript?
JavaScriptJavaScript Interview

What is Arrow and Normal Function in JavaScript?

Chief Editor
Last updated: February 16, 2025 6:06 pm
Chief Editor
Share
SHARE

Arrow Function vs Normal Function in JavaScript

In JavaScript, Arrow Functions and Normal Functions (also called Regular Functions) are two ways to define functions. They differ in syntax and behavior, especially regarding the this keyword.

Contents
1. Arrow Function (=>)2. Normal Function (Function Declaration / Expression)Key Differences:When to Use Which?Example Summary:

1. Arrow Function (=>)

Introduced in ES6 (2015), Arrow Functions provide a shorter and more readable syntax for writing functions.

Syntax:

javascriptCopyEditconst arrowFunction = (param1, param2) => {
  // Function body
  return param1 + param2;
};

If the function has a single expression, you can omit {} and return:

javascriptCopyEditconst sum = (a, b) => a + b;

Key Features of Arrow Functions:

  • No this binding: It inherits this from the surrounding lexical scope (parent scope).
  • Cannot be used as constructors: You cannot use new with arrow functions.
  • No arguments object: Arrow functions do not have their own arguments object.

Example:

javascriptCopyEditconst user = {
  name: 'John',
  greet: function() {
    const arrow = () => {
      console.log(this.name); // `this` is inherited from `greet` method
    };
    arrow();
  }
};

user.greet(); // John

2. Normal Function (Function Declaration / Expression)

Traditional way to define functions in JavaScript.

Syntax:

Function Declaration:

javascriptCopyEditfunction normalFunction(param1, param2) {
  return param1 + param2;
}

Function Expression:

javascriptCopyEditconst normalFunction = function(param1, param2) {
  return param1 + param2;
};

Key Features of Normal Functions:

  • Own this binding: this refers to the object that calls the function.
  • Can be used as constructors: You can use new with normal functions to create objects.
  • Has arguments object: You can access the arguments object inside the function.

Example:

javascriptCopyEditfunction show() {
  console.log(this); // `this` depends on how the function is called
}
show(); // Window (in global scope)

const obj = {
  name: 'Alice',
  greet: function() {
    console.log(this.name);
  }
};
obj.greet(); // Alice

Key Differences:

FeatureArrow FunctionNormal Function
this BindingInherits from lexical (surrounding) scopeDepends on the caller object (this is dynamic)
arguments ObjectNot availableAvailable
Constructor (new)Cannot be used as a constructorCan be used as a constructor
Shorter SyntaxYesNo

When to Use Which?

  • Arrow Functions: Best for callbacks, array methods (e.g., map, filter), and inside object methods (when this is inherited).
  • Normal Functions: Suitable when you need dynamic this binding or function constructors.

Example Summary:

javascriptCopyEdit// Arrow Function
const add = (a, b) => a + b;

// Normal Function
function multiply(a, b) {
  return a * b;
}

Understanding the difference between Arrow Functions and Normal Functions is crucial for handling this in JavaScript effectively.

Share This Article
Email Copy Link Print
Previous Article What is the this Keyword in JavaScript?
Next Article What is memoization in JavaScript?
Leave a Comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Your Trusted Source for Accurate and Timely Updates!

Our commitment to accuracy, impartiality, and delivering breaking news as it happens has earned us the trust of a vast audience. Stay ahead with real-time updates on the latest events, trends.
FacebookLike
XFollow
InstagramFollow
YoutubeSubscribe
LinkedInFollow
QuoraFollow
- Advertisement -
Ad imageAd image

Popular Posts

What is a Function Component in React?

A Function Component in React is a JavaScript function that returns React elements (JSX) representing…

By Chief Editor

What is Symentic HTML?

Semantic HTML refers to using HTML tags that convey the meaning or purpose of the…

By Chief Editor

How can you delay the dispatch in React?

To delay a dispatch in React, especially when using something like Redux or React state…

By Chief Editor

You Might Also Like

Frontend InterviewJavaScript

Explain Deep Copy and Shallow Copy in JavaScript.

By Chief Editor
JavaScriptJavaScript Interview

What are the map, filter, and reduce methods in JavaScript?

By Chief Editor
JavaScriptJavaScript Interview

What is one-way data binding in React?

By Chief Editor
JavaScript

What is a Closure in JavaScript?

By Chief Editor

Focus by CodeReveals is your dedicated platform for mastering tech interviews and advancing your development skills. Whether you’re aiming to become a Frontend Developer, Backend Developer, or simply preparing for your next big interview, we’re here to guide you every step of the way.

Our mission is to help aspiring developers gain real-world knowledge, build confidence, and succeed in technical interviews. We offer structured content, curated interview questions, coding challenges, and practical guidance — all designed by experienced professionals who understand what top tech companies are looking for.

At Improve, we don’t just teach — we prepare you to think like a developer, solve like an engineer, and present like a pro.

Join us and start improving today — because your dream tech job is within reach

Most Famous
  • HTML
  • CSS
  • JavaScript
  • NodeJS
Top Categories
  • JavaScript Interview
  • React Interview
  • Frontend Interview
  • Backend Interview
Usefull Links
  • Contact Us
  • Advertise with Us
  • Complaint
  • Cookies Policy
  • Privacy Policy
  • Donate

©2025  Code Reveals Inc. All Rights Reserved.

Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?