Arrow function, Normal function and function expression

 

//! This is normal type function declaration
function add(a,b){
  return a+b;
}
console.log(add(5,6));

//! This is function expression
const add1=function(a,b){
  return a+b;
}
console.log(add1(5,6));


//! This is arrow function
//* Yaha pe one line code isliye return or curly braces use nhi honge
const add2=(a,b)=>a+b;

console.log(add2(5,6));

Comments

Popular posts from this blog

React Installation with Vite and Tailwind css (Steps to Installation)

Insert Data In mongoDb

Class methods as an alternative Constructor