JavaScript Runtime

Execution Context, Call Stack & Hoisting

Learning Outcome

5

Understand Hoisting and its behavior

4

Create and use variables to store and manipulate data

3

Describe how Call Stack manages execution

2

Explain Execution Context and its types

Explain what a Dockerfile is

1

Understand how JavaScript executes code internally

6

Debug basic JavaScript execution problems

Restaurant Kitchen Analogy

Orders come → like function calls

Chef works one at a time → single-threaded

Orders stacked → last comes first served

This is called LIFO (Last In First Out)

Environment For Execution

whenever browser encounters → JS code it bringsJavascript Runtime Engine into Action

now it has to execute the Js code but 

How does it do that?

In JS engine there is Enviroment Called as Execution Context

What happens during code execution?

JavaScript allocates memory for variables and functions before execution starts

Every declaration gets stored in a dedicated environment

This environment, where memory allocation and execution happen, is called Execution Context

Now there are 2 types of EC

1 - Global Execution Context

When the JavaScript engine starts running a script file, it automatically creates a default environment called the Global Execution Context.

The Global Execution Context is the default environment where all code outside functions runs, and there is only one per JavaScript file.

How GEC encounters only one JS File ?

Frameworks like React and Angular use multiple JavaScript files

Managing many files directly can be complex

Tools like Webpack combine these files into bundles

This makes code execution more efficient and organized

what is WEBPACK?

Webpack is a popular JavaScript bundler used to manage and optimize the assets of modern web applications.

Webpack takes modules with dependencies (JavaScript, CSS, images, etc.)

It processes and combines them into one or more bundles

These bundles are optimized for faster delivery to the browser

This helps the JavaScript engine execute code more efficiently

In-Built Python Functions

 

Python provides ready-made functions.

Len : Show the Length of the string

Example :

print(len("Python"))   # Output: 6

Type : It Return the Datatype of the particular variable

Example :

print(type(10))        # Output: int

max : Find the Maximum Number from the group

Example :

print(max(5, 10, 3))   # Output: 10

 Variables

 

Variables store data.

name = "Sahil"
age = 20

Rules:

No spaces

Cannot start with number

Case-sensitive

Data Types

Common data types in Python

int → 10

 

float → 10.5

 

str → "Hello"

 

bool → True / False

 

Installing Python & Tools

Install Python

Download from python.org

Install and check version

Default Editor

IDLE (comes with Python)

Other Tools

  • ITV (learning environments)
  • Google Colab (online coding)
  • Anaconda (for data science)

Colab Example:

Open browser

Write code

Run instantly (no installation)

Hello World Program

The first program everyone writes:

print("Hello World")

Output:

Hello World

Steps:

Open Python/Colab

Type code

Run → see output

Insight:

This confirms your Python setup is working correctly

Summary

4

It is used in web development, AI, data science, and automation

3

Python is simple, powerful, and widely used across industries

2

Languages are categorized into low, medium, and high-level based on abstraction

1

Programming languages help humans communicate with computers effectively

Quiz

Who created Python?

A. Bill Gates

B. Elon Musk

C. Guido van Rossum

D. Mark Zuckerberg

Quiz-Answer

Who created Python?

A. Bill Gates

B. Elon Musk

C. Guido van Rossum

D. Mark Zuckerberg

Execution Context, Call Stack & Hoisting

By Content ITV

Execution Context, Call Stack & Hoisting

  • 12