Exploring terminologies related to functions and understanding the difference between them.

This article will explain the Function Statement, Function Expression, Function Declaration, Anonymous Functions, and First Class Functions.

Function Statement

The above function statement is also known as Function Declaration.

Function Expression

Anonymous Function

These types of functions are generally used as arguments inside other functions.

Parameter vs. Arguments

There is a difference between function parameters and arguments.

Here param1 and param2 are parameters, whereas “1,2” in line 5 are arguments.

First-Class Functions

Functions in javascript are treated like any other variable. This means a function can be passed as an argument to other functions, can be…


“Everything in Javascript happens inside an execution context”

Execution context can be thought as a big box . It has two parts one is Memory component and other is Code component.

Memory Component

In memory space , every variable and function is stored as a key, value pair. It is also known as variable environment.

Code Component

Code component is the place where every line of code is executed one by one. It is also known as thread of execution.

“ Javascript is a synchronous single-threaded language”

Code Execution

It happens in two phases one is Memory Allocation Phase and other is Code Execution Phase

Memory Allocation Phase:

Akshat Mangal

CS Junior @ IIIT Gwalior

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store