Skip to main content

Command Palette

Search for a command to run...

ARROW FUNCTIONS AND REGULAR FUNCTIONS

Updated
2 min read
ARROW FUNCTIONS AND REGULAR FUNCTIONS
S

I am an aspiring developer from Nigeria.

Firstly lets start by getting to know what a function is.

A function can simply be seen as a block of code written to perform specific task. And in javascript we two (2) in which functions can be written:

  1. Arrow functions.

  2. Regular functions.

Lets talk about each of the functions listed above:

ARROW FUNCTIONS

Arrow functions can also be called 'fat arrow functions'. It a is new feature that was introduced ES6(ECMAscript 6, which was created by standardize javascript). The arrow functions in javascript has a more concise syntax for writing functions expressions, Unlike the regular functions this type of function is only 'callable' and not 'constructible'.

THE IMAGE BELOW SHOWS AN ARROW FUNCTION THAT ADDS THREE NUMBERS

arrow function.jpg

REGULAR FUNCTIONS

Regular functions are functions that are called using function declarations or expressions, unlike arrow functions, regular functions are both 'callable' and 'constructible'. Since they are constructible, they can be called using a new keyword.

THE IMAGE BELOW SHOWS A REGULAR FUNCTION THAT ADDS THREE NUMBERS

a normal function.jpg o

More from this blog

sowlomon's Blog

9 posts