Friday, 18 Jul 2025
  • My Interests
  • My Saves
  • Try Intents
Subscribe
improve-logo improve-logo
  • Home
  • HTML

    What are the async and defer attributes in the “script” tag?

    By Chief Editor
    What is Symentic HTML

    What is Symentic HTML?

    By Chief Editor

    What is a Meta Tag in HTML?

    By Chief Editor

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

    By Chief Editor

    Difference between HTML Tag and HTML Element in HTML?

    By Chief Editor

    What is Doctype HTML in HTML?

    By Chief Editor
  • JavaScript

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

    By Chief Editor

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

    By Chief Editor

    What are the Rest and Spread operators in JavaScript?

    By Chief Editor

    How to Reverse a String in JavaScript: Two Essential Methods

    By Chief Editor

    What is a Promise in JavaScript, and what are its parameters?

    By Chief Editor

    What is Arrow and Normal Function in JavaScript?

    By Chief Editor
  • Frontend Interview

    What is Block level Element and Inline Level Element?

    By Chief Editor

    What is Symentic HTML?

    By Chief Editor

    How to Reverse a String in JavaScript: Two Essential Methods

    By Chief Editor

    Is JavaScript a synchronous or asynchronous language?

    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
  • Backend Interview

    Lazy Loading in React.js: Boosting Performance and Reducing Load Time

    By Chief Editor

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

    By Chief Editor

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

    By Chief Editor

    What is a Higher-Order Component (HOC) in React?

    By Chief Editor

    What are the Rest and Spread operators in JavaScript?

    By Chief Editor

    What is Callback Hell in JavaScript?

    By Chief Editor
  • Nodejs
  • Frontend Interview
  • Backend Interview
  • React Interview
  • JavaScript Interview
  • Contacts Us
  • Advertise with Us
  • Complaint
  • Privacy Policy
  • Cookie Policy
  • Donate
  • 🔥
  • ReactJS
  • JavaScript
  • JavaScript Interview
  • React Interview
  • HTML
  • Frontend Interview
  • CSS
  • Redux
  • Javascript
  • System Design
Font ResizerAa
ImproveImprove
  • My Saves
  • My Interests
  • My Feed
  • History
  • Technology
Search
  • Homepage
  • Pages
    • Home
    • Blog Index
    • Contact Us
    • Search Page
    • 404 Page
  • Features
    • Post Headers
    • Layout
  • Personalized
    • My Feed
    • My Saves
    • My Interests
    • History
  • About
  • Categories
    • Technology
  • Categories
Have an existing account? Sign In
Follow US
© 2022 Code Reveals Inc. All Rights Reserved.

Home 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 localization in React?

Localization (l10n) in React refers to the process of adapting your application to support multiple…

By Chief Editor

What is Scope in JavaScript?

Scope in JavaScript refers to the context in which variables are accessible. It determines which…

By Chief Editor

What are the drawbacks of React?

Understanding the Drawbacks of React: Key Considerations for Developers React is one of the most…

By Chief Editor

You Might Also Like

JavaScriptJavaScript Interview

What is the this Keyword in JavaScript?

By Chief Editor
JavaScriptJavaScript Interview

What is one-way data binding in React?

By Chief Editor
JavaScriptJavaScript Interview

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

By Chief Editor
JavaScriptFrontend Interview

Explain Deep Copy and Shallow Copy in JavaScript.

By Chief Editor
improve-logo

Code Reveals is a cutting-edge software development company dedicated to delivering high-quality, scalable, and innovative solutions for businesses of all sizes. Our team of expert developers, designers, and engineers specializes in creating custom software, web applications, mobile apps, and enterprise solutions that are tailored to meet the unique needs of our clients.

Most Famous
  • HTML
  • CSS
  • JavaScript
  • Node
Top Categories
  • Frontend Interview
  • Backend Interview
  • React Interview
  • JavaScript Interview
Usefull Links
  • Contacts Us
  • Advertise with Us
  • Complaint
  • Privacy Policy
  • Cookie Policy
  • Donate

©2025  Code Reveals Inc. All Rights Reserved.

Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?