javascript

Arrow Functions

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.

Recent Posts

Cloudinary vs. AWS vs. ImageKit.io vs. Cloudflare

Choosing the right asset management service is vital. Cloudinary is frequently mentioned, but how does…

16 hours ago

How to Integrate Cloudinary with PHP

Cloudinary is a powerful cloud-based media management platform that allows you to upload, store, manage,…

3 days ago

Trump Extends U.S. TikTok Sale Deadline to September 2025

In a surprising turn of events, former President Donald Trump announced on June 19, 2025,…

2 weeks ago

Master React Native Flexbox

Flexbox is a powerful layout system in React Native that allows developers to create responsive…

2 weeks ago

Getting Started With TensorFlow

"The journey of a thousand miles begins with a single step." — Lao Tzu Welcome…

3 weeks ago

Your Mind is a Supercomputer

We often describe ourselves as "processing" information, "rebooting" after a bad day, or feeling "overloaded"…

3 weeks ago