- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is an Arrow Function in JavaScript?
Fat arrow function as the name suggests helps in decreasing line of code. The syntax => shows fat arrow. This also avoids you to write the keyword “function” repeatedly.
Syntax
Here’s the syntax −
argument => expression
Use the following for more than one argument −
(argument1 [, argument2]) => expression
Let’s compare a function with and withour fat arrow −
Function in JavaScript
var rank = [7,8,9]; var display = rank.map(function(num) { return num * num; });
Fat Arrow function in JavaScript
var rank= [7,8,9]; var display = rank.map((num) => num*num); document.write(arr)
Arrow function definitely reduces the code lines.
- Related Articles
- What is a fat arrow function in JavaScript?
- How to define an Arrow Function in JavaScript?
- What is the Arrow Function in ReactJS?
- What is an arrow operator, `->` in C++?
- How to access 'this' keyword inside an arrow function in JavaScript?
- What is an anonymous function in JavaScript?
- Arrow functions in Javascript
- What is arrow operator in C++?
- Lambdas with Arrow Functions in JavaScriptLambdas with Arrow Functions in JavaScript
- Fat arrow functions in JavaScript
- Concise arrow functions in JavaScript
- Explain the arrow function syntax in TypeScript
- What is "function*" in JavaScript?
- Detecting arrow key presses in JavaScript?
- Higher-Order Arrow Functions in JavaScript.

Advertisements