Arrow functions, also called “fat arrows” were introduced with ES6 as a new syntax for writing Javascript functions.
By utilising a token (=>) that looks like a fat arrow, they are a more concise and elegant way of writing function expressions.
Basic Syntax
//ES5 Way
function myFunc() {
//statements here ...
}
//ES6 Way
myFunc = () => {
//statements here ...
}
Parentheses in ES6 functions are optional when only one parameter is passed.
myFunc = val => {
return val += 1;
}
alert(myFunc(2)); //3
But if no parameters are passed to the function, then parentheses are required.
Neumorphism design, alternatively termed as "soft UI" or "new skeuomorphism," represents a design trend that…
Debugging JavaScript code can sometimes be challenging, but with the right practices and tools, you…
Service Workers are one of the core features of modern web applications, offering powerful capabilities…
A database-driven website is a dynamic site that utilizes a database to store and manage…
Toasts are user interface elements commonly used in software applications, especially in mobile app development…
JavaScript has long been synonymous with frontend web development, powering interactive and dynamic user interfaces…