What is the difference between arrow and normal functions?
The main differences between arrow function and normal function are based on some parameters like.
- Syntax
- Arguments that are binding.
- "this" keyword is used to describe the use.
- Utilizing a keyword that is new.
- No duplicates of identified parameters.
Syntax of normal functions
// Function declaration
function printHello(name) {
return `Hey ${name}`;
}
NOTE: If you want to read more about Regular vs Arrow functions then you can visit here.
// Function expression
const printHello = function(name) {
return `Hey ${name}`;
}
Syntax of arrow functions
const printHello = (name) => `Hey ${name}`;
BY Best Interview Question ON 08 Sep 2022