7 Important JavaScript Concepts PDF
7 Important JavaScript Concepts PDF
S O U V I K M I T R A
February 2024
@THECODEMITTER
Presented by :
Souvik Mitra Swipe
7 KEY JAVASCRIPT CONCEPTS
Hoisting
Hoisting in JavaScript is a mechanism where
variable and function declarations are moved to
the top of their containing scope during the
compilation phase, before the code is executed.
Closure
A closure is a combination of a function and the
lexical environment within which that function
was declared. It allows a function to access
variables from its surrounding scope even after
the outer function has finished executing.
Scope
Scope in JavaScript refers to the visibility and
accessibility of variables and functions within a
particular context or region of code.
Callbacks
A callback function is a function that is
passed as an argument to another function
and is executed after a particular task or
event has occurred. It allows for
asynchronous programming by providing a
way to handle actions that occur at
unpredictable times, such as the completion
of an asynchronous operation like fetching
data from a server or handling user
interactions like clicking a button.
Promises
Promises were introduced as a solution to
callback hell where multiple nested callback
functions are used to handle asynchronous
operations. It allows you to handle
asynchronous operations more easily and
efficiently compared to traditional callback-
based approaches.
A Promise can be in one of three states:
1. Pending: Initial state, neither fulfilled nor
rejected.
2. Fulfilled: The operation completed
successfully.
3. Rejected: The operation failed.
Currying
Currying is a technique in JavaScript where
a function with multiple arguments is
transformed into a sequence of functions,
each taking a single argument. This allows
you to create new functions by partially
applying the original function with some of
its arguments, resulting in a more flexible
and reusable code.