About
In this code snippet, we’ll learn how to use arrow functions in Javascript.
Arrow functions are nothing more than “syntactic sugar” to make writing a function a bit shorter. Both examples below achieve the same thing but the second one is just a bit more compact that’s all.
Let’s see the code example below.
Code:
//1. way////////////////////////////////////////// const someFunction = function(){ console.log("I am a function."); } someFunction(); ////////////////////////////////////////////////// //2. way////////////////////////////////////////// const someOtherFunction = () => { console.log("I am another function."); } someOtherFunction(); //////////////////////////////////////////////////