Js - Arrow Function


/* normal function

----------------------------- ?

//  1st way :

//  function harry(){

//   console.log("normal function")

//  }

// harry()


// 2nd way :

// const harry=function(){

//   console.log("normal function");

// }

// harry()



/* Arrow function

----------------------------------- */

// const harry=() => {

//   console.log("arrow function")

// }

// harry()



// const harry = () => {return "hello world"} 

// or 

// const harry = () => "hello world"

// console.log(harry())



// #for single parameter , no paranthsisi required

// let harry = name => "good morning " + name

// console.log(harry('himanshu'))


// #for multiple parameter , paranthsisi required

let harry = (name,end) => name + " good morning " + end;

console.log(harry("himanshu","bye"));


0 Comments