Return to site

JAVASCRIPT CODING: Converting a regular JavaScript function to the JavaScript arrow 🏹

· fullstack

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?

All Posts

Almost done…

We just sent you an email. Please click the link in the email to confirm your subscription!