Arrow Functions

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

More To Explore

Share This Post

small_c_popup.png

Need help?

Let's have a chat...


Login

Jump Back In!

Here at Webolution Designs, we love to learn. This includes sharing things we have learned with you. 

Register

Begin Your Learning Journey Today!

Come back inside to continue your learning journey.