JavaScript

May 16, 2023

Simple Arrow Function Using JavaScript

Simple Arrow Function Number


let ArrowFunction = (a, b) => 5 * 7;
// Created a variable arrowFunction and initialized a ,b  
// in it and passing the parameters to the arrowfunction 

console.log(ArrowFunction());

Output


35

Simple Arrow Function String


let ArrowFunction = () => "Hello World";
// Created a variable arroFunction and did not initialize any value
// in it and the parameter is being passed to the arrowfunction

console.log(ArrowFunction());

Output


Hello World

Simple Arrow Function Length


let country = ["India", "Bangladesh", "Srilanka", "China"];
//Defined variable country and initialize array string value

console.log(country.map((country) => country.length));
//Defined variable country and passed some string values in it array
//called all strings via string.map
//Shows the length of all index values count word

Output


[ 5, 10, 8, 5 ]

by : Nehal Akhtar

Quick Summary:

Different Type Arrow Function In JavaScript Programme