Menu

Post image 1
Post image 2
1 / 2
0

What is Middleware in Express and How It Works

DEV Community·Abhishek sahni·27 days ago
#E624ay9J
Reading 0:00
15s threshold

Arrow function Introduced in ES6. They provide concise syntax to write a standard function. Standard Function : function add ( a , b ){ return a + b ; } Enter fullscreen mode Exit fullscreen mode Arrow Function : const add = ( a , b ) => a + b ; Enter fullscreen mode Exit fullscreen mode Arrow function are anonymous don't have name . You cannot give it a name during definition. Assigned to Variables : To reuse or reference an arrow function, you must assign it to a variable (e.g., const myFunc = () => { ... }; ). const greet = () => { console . log ( " Hello " ); }; greet (); // reuse greet (); // reuse again Enter fullscreen mode Exit fullscreen mode They are design for inline code that and reduce syntax . It is very useful for callbacks. Key Features : Single Parameter (no parentheses needed): const square = x => x * x; Implicit Return : Single line function automatically return without return keyword.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More