From 126e04bb9fb1515f64c4a15935c422dbac2cda2f Mon Sep 17 00:00:00 2001 From: manivardhanreddythalla2007 Date: Thu, 20 Nov 2025 18:47:02 +0530 Subject: [PATCH] feat: add jaw-dropping JS interview questions --- jaw-dropping-questions.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 jaw-dropping-questions.md diff --git a/jaw-dropping-questions.md b/jaw-dropping-questions.md new file mode 100644 index 00000000..544d788f --- /dev/null +++ b/jaw-dropping-questions.md @@ -0,0 +1,24 @@ +cat > jaw-dropping-questions.md << 'EOF' + +cat > jaw-dropping-questions.md << 'EOF' +# Jaw-Dropping JavaScript Interview Questions + +Here are some advanced and surprising JavaScript interview questions I recently encountered. + +## 1. Why does [] == ![] evaluate to true? +Answer: Because [] becomes "", ![] becomes false → "" == false → true. + +## 2. What is event loop starvation? +Answer: When microtasks continuously run and block macrotasks from executing. + +## 3. Difference between microtask queue and macrotask queue? +Answer: Microtasks run immediately after current execution; macrotasks run in next event loop step. + +## 4. Why is typeof null === "object"? +Answer: Legacy bug from the first JS implementation; null was represented as a null pointer. + +## 5. What happens when you delete an array index? +Answer: It leaves a hole (empty slot), does NOT reindex the array. + +## 6. Explain Temporal Dead Zone with an example. +Answer: A period between variable creation and initialization where using `let`/`const` throws ReferenceError.