Arrow Function Vs Normal Function In JavaScript In Urdu|Hindi ?| In Depth Explanation And Advantage
There’s another very simple and concise syntax for creating functions, that’s often better than Function Expressions. It’s called Arrow Functions. Arrow functions (also called “fat arrow functions”) are undoubtedly one of the more popular features of ES6. It’s much shorter! We are able to omit the curly braces and the return statement due to implicit returns (but only if there is no block ). If your function is in a block, you must also use the explicit return statement. Basics Of Arrow Function : https://www.youtube.com/watch?v=orZGX2QTaQ4 1. No parameters If there are no parameters, you can place an empty parentheses. In fact, you don’t even need the parentheses! 2. Single parameter With these functions, parentheses are optional. 3. Multiple parameters Parentheses are required for these functions. 4. Statements (as opposed to expressions) In its most basic form, a function expression produces a value, while a function statement performs an action. With the arrow function, it is important to remember that statements need to have curly braces. Once the curly braces are present, you always need to write return as well. 5. “Block body” If your function is in a block, you must also use the explicit return statement. It is important to note that arrow functions are anonymous, which means that they are not named. This anonymity creates some issues: Harder to debug When you get an error, you will not be able to trace the name of the function or the exact line number where it occurred. 2. No self-referencing If your function needs to have a self-reference at any point (e.g. recursion, event handler that needs to unbind), it will not work. Track : Electro-Light - Symbolism [NCS Release] Music Provided by NoCopyrightSounds Watch : https://www.youtube.com/watch?v=__CRWE-L45k Follow Me On : Facebook : https://www.facebook.com/profile.php?id=100005126296510 Github : https://github.com/Rehankhalil462 Instagram : https://www.instagram.com/devtechcare/ #arrow #functions #es6 #javascript #javascriptarrowfunctions #arrowfunctions #arrowfunctionses6 #es6arrowfunctions #es6writehigherorderarrowfunctions #arrowfunctionsjavascript #es6arrowfunctionsandthis #nestedarrowfunctionsjavascript #howtousearrowfunctions #hindi #urdu #ecmascript #fatarrowfunctions #fatarrowfunctionsjavascript #thisinarrowfunctionsjavascript #implicit #return #curly #braces #devtechcare #dev #tech #care #xeetechcare #alanai #alan #ai
There’s another very simple and concise syntax for creating functions, that’s often better than Function Expressions. It’s called Arrow Functions. Arrow functions (also called “fat arrow functions”) are undoubtedly one of the more popular features of ES6. It’s much shorter! We are able to omit the curly braces and the return statement due to implicit returns (but only if there is no block ). If your function is in a block, you must also use the explicit return statement. Basics Of Arrow Function : https://www.youtube.com/watch?v=orZGX2QTaQ4 1. No parameters If there are no parameters, you can place an empty parentheses. In fact, you don’t even need the parentheses! 2. Single parameter With these functions, parentheses are optional. 3. Multiple parameters Parentheses are required for these functions. 4. Statements (as opposed to expressions) In its most basic form, a function expression produces a value, while a function statement performs an action. With the arrow function, it is important to remember that statements need to have curly braces. Once the curly braces are present, you always need to write return as well. 5. “Block body” If your function is in a block, you must also use the explicit return statement. It is important to note that arrow functions are anonymous, which means that they are not named. This anonymity creates some issues: Harder to debug When you get an error, you will not be able to trace the name of the function or the exact line number where it occurred. 2. No self-referencing If your function needs to have a self-reference at any point (e.g. recursion, event handler that needs to unbind), it will not work. Track : Electro-Light - Symbolism [NCS Release] Music Provided by NoCopyrightSounds Watch : https://www.youtube.com/watch?v=__CRWE-L45k Follow Me On : Facebook : https://www.facebook.com/profile.php?id=100005126296510 Github : https://github.com/Rehankhalil462 Instagram : https://www.instagram.com/devtechcare/ #arrow #functions #es6 #javascript #javascriptarrowfunctions #arrowfunctions #arrowfunctionses6 #es6arrowfunctions #es6writehigherorderarrowfunctions #arrowfunctionsjavascript #es6arrowfunctionsandthis #nestedarrowfunctionsjavascript #howtousearrowfunctions #hindi #urdu #ecmascript #fatarrowfunctions #fatarrowfunctionsjavascript #thisinarrowfunctionsjavascript #implicit #return #curly #braces #devtechcare #dev #tech #care #xeetechcare #alanai #alan #ai