function ke liye "this" kam nahi karta hai, only for objects.


arrow function

simple function
arrow function
here you can see conversion difference - bus function keyword hata ke arrow laga dena hai


these are ways to write arrow function

agar curly birect nahi use kiye to return keyword nahi likhan hai, i.e. implicit return
REact me kam ayega

curly birect laga ke- explicit return



agar object return karna ha implicit se to birect lagana must hai





Different ways of writing functions in JavaScript


1. Function declaration (traditional)
function add(a, b) {  
console.log(a + b);
}

add(2, 3);


2. Function Expression
const add = function (a, b) {
console.log(a + b);
}

add(2, 3);



3. arrow function
let add = (a, b) => {
      return a + b;
}

console.log(add(3, 2));





arrow function has some limitiation:-
  1. this keyword can,t used in object.
  2. hoisting not possible ->means normal function ko kahi bhi likh do aur call kar do, but arrow function pahale define karo, then call.