Traditionally, functions are defined in JavaScript by using the “function” keyword. In ES2015, arrow functions were introduced. For C# folks, this will look similar to lambdas. Let’s first look at a traditional function syntax…
function getName(){
return ‘Bongo’;
}
console.log(getName());
The output would be “Bongo”. Let’s change the syntax to using arrow function syntax…
let getName = () => {
return ‘Bongo’;
}
console.log(getName());
This would also output “Bongo” to the console. Basically, arrow functions made the syntax for writing functions cleaner and smaller.
Happy Coding!
Clay Hess