Arrow functions are a concise syntax for writing anonymous functions in JavaScript, introduced in ECMAScript 6. They allow you to define functions using a shorter syntax, omitting the function ‘keyword’ and providing an implicit return for single expressions.
Arrow functions inherit the ‘this’ context from the surrounding code, making them particularly useful for maintaining lexical scoping. However, they lack an ‘arguments’ object and cannot be used as constructors, limiting their versatility compared to traditional functions.
function arrFun(){
console.log("Hello Coders!");
}
arrFun();
const arrFun = () => {
console.log( "Hello Coders!" );
}
arrFun();