Supported Browsers Limitations of Arrow Functions Chrome 45 and aboveEdge 12 and aboveFirefox 22 and aboveOpera 32 and aboveSafari 10 and above Arrow functions in JavaScript Similar Reads What is Arrow Function ? Arrow function {()=>} is concise way of writing JavaScript functions in shorter way. Arrow functions were introduced in the ES6 version. They make our code more structured and readable.... Arrow Function without Parameters Javascript const gfg = () => { console.log( "Hi from GeekforGeeks!" ); } gfg();... Arrow Function with Parameters Javascript const gfg = ( x, y, z ) => { console.log( x + y + z ) } gfg( 10, 20, 30 );... Arrow Function with Default Parameters Javascript const gfg = ( x, y, z = 30 ) => { console.log( x + " " + y + " " + z); } gfg( 10, 20 );... Advantages of Arrow Functions Arrow functions reduce the size of the code.The return statement and function brackets are optional for single-line functions.It increases the readability of the code.Arrow functions provide a lexical this binding. It means, they inherit the value of “this” from the enclosing scope. This feature can be advantageous when dealing with event listeners or callback functions where the value of “this” can be uncertain.... Limitations of Arrow Functions Arrow functions do not have the prototype property.Arrow functions cannot be used with the new keyword.Arrow functions cannot be used as constructors.These functions are anonymous and it is hard to debug the code.Arrow functions cannot be used as generator functions that use the yield keyword to return multiple values over time.... Supported Browsers Chrome 45 and aboveEdge 12 and aboveFirefox 22 and aboveOpera 32 and aboveSafari 10 and above... Tags: #ES6 #javascript-functions #JavaScript #Web Technologies Limitations of Arrow Functions
Contact Us