Return to site
JAVASCRIPT CODING: Converting a regular JavaScript function to the JavaScript arrow 🏹
·
Here we have two functions 𝙨𝙪𝙢𝙁𝙣 and 𝙨𝙪𝙢𝙁𝙣𝘼𝙧𝙧𝙤𝙬.
Both produce the same output:
// Javascript Function
const sumFn = function(a,b) {
return a + b;
}
// Javascript Arrow Function
const sumFnArrow = (a,b) => a+b;
console.log(sumFn(5,10)); //15
console.log(sumFnArrow(5,10)); //15
Does anyone know how arrow function differs from the simple JavaScript function?