0% found this document useful (0 votes)
5 views2 pages

JavaScript Execution Contexts & Hoisting

Uploaded by

lisowih424
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

JavaScript Execution Contexts & Hoisting

Uploaded by

lisowih424
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

 Everything in JavaScript happens inside an “Execution Context”

 Execution Context => Memory + Code

 Call stack maintains the order of execution of execution stack.

Hoisting
 Hoisting in JavaScript is a behavior, where variable and function declarations are
moved to the top of their scope (either global or local) before the code executes,
allowing you to access them before they are declared.
 However, with let and const variable, there's a catch known as the 'temporal
dead zone,' where these variables are hoisted but not initialized, leading to a
ReferenceError if accessed before their declaration.

IIFE ( Immediately Invoked Function Expressions )

A higher-order function (HOF) is a function that:


✅ Takes another function as an argument OR
✅ Returns a function

Higher-Order Purpos
Method e
forEach Loops through each item in an
() array
map( Transforms each item and returns a
) new array
filter( Returns a new array with only elements that match a
) condition
reduce Reduces an array to a single
() value
find( Returns the first element that matches a
) condition
sort( Sorts the elements of an
) array
some( Returns true if at least one element matches a
) condition
every Returns true if all elements match a
() condition

[Link]( (accumulator, currValue) => (<function>),


initialValue )

You might also like