π§© JavaScript Quiz
In JavaScript, which keyword is used to declare a variable that cannot be reassigned after its initial value is set?
In JavaScript, which keyword is used to declare a variable that cannot be reassigned after its initial value is set?
Anonymous Quiz
13%
let
6%
immutable
69%
const
12%
var
localStorage Persistence: The Silent Bank Vault
Whatβs happening?
localStorage is like a browserβs hard drive. It survives tab/window closures, even system reboots.
Unlike sessionStorage (which dies with the tab), localStorage sticks until explicitly cleared (localStorage.clear() or user clears browsing data).
Gotcha: Itβs synchronous meaning it blocks the main thread if you store large data.
Whatβs happening?
localStorage is like a browserβs hard drive. It survives tab/window closures, even system reboots.
Unlike sessionStorage (which dies with the tab), localStorage sticks until explicitly cleared (localStorage.clear() or user clears browsing data).
Gotcha: Itβs synchronous meaning it blocks the main thread if you store large data.
β€2π1
JavaScript Event Loop: The Truth About setTimeout(0)
The Real Order of Operations:
1. Call Stack: Synchronous code (A, D) - This is where JavaScript executes code sequentially, like reading a script.
2. Microtasks: Promises (C) - These are small tasks that need to be executed ASAP after the current script, before the next rendering. Think of them as urgent side tasks.
3. Macrotasks: Timeouts/Intervals (B) - These are longer tasks that the browser queues up to do whenever it gets a chance. They're not as urgent as microtasks.
Golden Rule: "0ms" doesn't mean immediate - it means "next event loop tick".
The Real Order of Operations:
1. Call Stack: Synchronous code (A, D) - This is where JavaScript executes code sequentially, like reading a script.
2. Microtasks: Promises (C) - These are small tasks that need to be executed ASAP after the current script, before the next rendering. Think of them as urgent side tasks.
3. Macrotasks: Timeouts/Intervals (B) - These are longer tasks that the browser queues up to do whenever it gets a chance. They're not as urgent as microtasks.
Golden Rule: "0ms" doesn't mean immediate - it means "next event loop tick".
β€6
π§© JavaScript Quiz
In JavaScript, what does the "NaN" stand for?
In JavaScript, what does the "NaN" stand for?
Anonymous Quiz
74%
Not A Number
5%
No Answer Needed
14%
Notation of Null
8%
Negative Absolute Number
π3
π§© JavaScript Quiz
Which method is used to add an element to the end of an array?
Which method is used to add an element to the end of an array?
Anonymous Quiz
71%
.push()
16%
.concat()
11%
.pop()
2%
.slice()
What is the Output order for the above code?
Anonymous Quiz
47%
"Hello" β "World"
30%
"World" β "Hello"
12%
Only "Hello"
11%
Race condition