JavaScript Master Notes
Comprehensive Notes Covering Basic and Advanced JavaScript
Part 1: Basic JavaScript
Lecture 1: Introduction to JavaScript
JavaScript is a high-level, interpreted programming language that adds interactivity to web pages. It
runs in the browser and allows developers to manipulate HTML and CSS dynamically.
Example:
[Link]('Hello, JavaScript!');
History:
Developed by Brendan Eich in 1995, JavaScript was initially called Mocha, then LiveScript, before
becoming JavaScript. It’s now standardized under the ECMAScript specification.
Lecture 3: Variables and Data Types
Variables are containers for storing data values. In JavaScript, we declare them using var, let, or
const.
Example:
let name = 'Alice';
const PI = 3.14;
var age = 25;
Data types include: Number, String, Boolean, Undefined, Null, Object, and Symbol.
Part 2: Advanced JavaScript
Execution Context & Hoisting
When JavaScript code runs, it creates an Execution Context which determines how variables and
functions are accessed.
There are two phases:
1. Creation Phase – memory is allocated for variables and functions.
2. Execution Phase – code runs line-by-line.
Example:
[Link](a); // undefined
var a = 10;
Here, 'a' is hoisted to the top, but its value is assigned later.
Async / Await Example:
async function fetchData() {
let data = await fetch('[Link]
let json = await [Link]();
[Link](json);
}
fetchData();
Async/await makes asynchronous code look synchronous, improving readability.