Answer:
1-
(10 - 4 = 6, then + "2" → string concat → "62")
2-
(10 - 4 = 6, then 6 - 2 = 4)
1-
"10" - "4" + "2" → "62"
(10 - 4 = 6, then + "2" → string concat → "62")
2-
"10" - "4" - "2" → 4
(10 - 4 = 6, then 6 - 2 = 4)
Answer & Explanation:
null becomes 0 in numeric context.
null represents "no value" but converts to 0 in numeric operations.
undefined is not a number → NaN.
undefined represents "not defined" and converts to NaN in numeric operations
// 1
console.log(null + 1);
👉 null + 1 → 1
null becomes 0 in numeric context.
null represents "no value" but converts to 0 in numeric operations.
// 2
console.log(undefined + 1);
👉 undefined + 1 → NaN
undefined is not a number → NaN.
undefined represents "not defined" and converts to NaN in numeric operations
======The Hoisting Illusion - Explained======
✅ Case 1: Function Declaration
Output: "Hello!"
Explanation:
✅ Case 1: Function Declaration
greet();
function greet() {
console.log("Hello!");
}
Output: "Hello!"
Explanation:
- Function declarations are fully hoisted to the top of their scope
- Both the function name AND its body are hoisted
- The JavaScript engine effectively reorganizes the code
like this:👇
function greet() {
console.log("Hello!");
}
greet(); // Now it's called after declaration❌ Case 2: Function Expression (with const/let)
Error: Cannot access 'greet' before initialization
Explanation:
greet();
const greet = () => console.log("Hi");
Error: Cannot access 'greet' before initialization
Explanation:
- Variable declaration is hoisted, but NOT the assignment
- const and let variables enter the Temporal Dead Zone (TDZ) until initialization
- The engine sees it like:👇
const greet; // TDZ starts here - cannot access greet
greet(); // ❌ Error: Trying to access in TDZ
greet = () => console.log("Hi"); // Initialization happens here
🔸Function Expression:🔸
Function Expression ka matlab hai jab hum ek function ko kisi variable ke saath assign karte hain.
Jaise:
Isme greet ek variable hai jo ek function ko hold kar raha hai. Function Expressions ko hoist nahi kiya jata, iska matlab hai ki aap inhe declare karne se pehle call nahi kar sakte.
Agar aap aisa karte hain, toh error aayega kyunki variable hoist hota hai, lekin uska value assign nahi hota jab tak code us line tak nahi pahuchta.
🔸Hoisting:🔸
Hoisting ka matlab hai ki JavaScript mein functions aur variables ko unke scope ke top par le jaya jata hai.
Function declarations poori tarah se hoist hoti hain, matlab unka naam aur body dono upar le jaye jate hain.
Isliye aap function ko uske declare hone se pehle bhi call kar sakte ho. Lekin agar aap function expression use karte ho, jaise const ya let ke saath, toh sirf variable declaration hoist hoti hai, assignment nahi.
Is wajah se aapko "Cannot access before initialization" error milta hai.
Function Expression ka matlab hai jab hum ek function ko kisi variable ke saath assign karte hain.
Jaise:
const greet = () => console.log("Hi");Isme greet ek variable hai jo ek function ko hold kar raha hai. Function Expressions ko hoist nahi kiya jata, iska matlab hai ki aap inhe declare karne se pehle call nahi kar sakte.
Agar aap aisa karte hain, toh error aayega kyunki variable hoist hota hai, lekin uska value assign nahi hota jab tak code us line tak nahi pahuchta.
🔸Hoisting:🔸
Hoisting ka matlab hai ki JavaScript mein functions aur variables ko unke scope ke top par le jaya jata hai.
Function declarations poori tarah se hoist hoti hain, matlab unka naam aur body dono upar le jaye jate hain.
Isliye aap function ko uske declare hone se pehle bhi call kar sakte ho. Lekin agar aap function expression use karte ho, jaise const ya let ke saath, toh sirf variable declaration hoist hoti hai, assignment nahi.
Is wajah se aapko "Cannot access before initialization" error milta hai.
🔥1
Coders Mantra
Answer will be posted on 👉 @CodersMantra
✅ Answer & Explanation:
Output →
Start
End
Timeout
👉 Even setTimeout(..., 0) goes to the event queue, so synchronous code runs first.
Output →
Start
End
Timeout
👉 Even setTimeout(..., 0) goes to the event queue, so synchronous code runs first.
30 Best Frontend Developer Interview Questions & Answers.pdf
3.5 MB
30 Best Frontend Developer Interview Questions & Answers
🌍 Remote Hiring Companies (Worldwide / USA / Europe / India)
Find your next opportunity at top global companies👇
---
🇺🇸 Google
🌐 [careers.google.com](https://careers.google.com/)
📍 USA, Europe, India, Remote
🇺🇸 Amazon
🌐 [amazon.jobs](https://www.amazon.jobs/)
📍 Worldwide
💻 Microsoft
🌐 [careers.microsoft.com](https://careers.microsoft.com/)
📍 Worldwide (Remote-first)
📱 Meta (Facebook, Instagram, WhatsApp)
🌐 [metacareers.com](https://www.metacareers.com/)
📍 Fully Remote
🍎 Apple
🌐 [jobs.apple.com](https://jobs.apple.com/)
📍 Fully Remote
---
💼 GitHub
🌐 [github.com/careers](https://github.com/careers)
📍 USA, Remote
💻 GitLab
🌐 [about.gitlab.com/jobs](https://about.gitlab.com/jobs)
📍 Worldwide (Remote-first)
🌐 Automattic (WordPress)
🌐 [automattic.com/work-with-us](https://automattic.com/work-with-us)
📍 Worldwide (Fully Remote)
⚙️ Zapier
🌐 [zapier.com/jobs](https://zapier.com/jobs)
📍 Worldwide (Fully Remote)
🛍 Shopify
🌐 [shopify.com/careers](https://www.shopify.com/careers)
📍 Canada, USA, Remote-first
🚀 Atlassian
🌐 [atlassian.com/company/careers](https://www.atlassian.com/company/careers)
📍 Worldwide (Remote Options)
---
☁️ Salesforce
🌐 [salesforce.com](https://www.salesforce.com/)
📍 Worldwide
👽 Reddit
🌐 [redditinc.com/careers](https://www.redditinc.com/careers)
📍 USA, Remote
🧠 Notion
🌐 [notion.so/careers](https://www.notion.so/careers)
📍 USA, Remote
🎨 Canva
🌐 [canva.com/careers](https://www.canva.com/careers)
📍 Australia, Remote
---
🏢 AddStructure
🌐 [bazaarvoice.com](https://www.bazaarvoice.com/)
📍 USA
🌎 Adeva
🌐 [adevait.com](https://adevait.com/)
📍 Asia, Africa, Europe, South America, USA
💼 Adzuna
🌐 [adzuna.co.uk](https://www.adzuna.co.uk/)
📍 Worldwide
🧠 AE Studio
🌐 [ae.studio](https://ae.studio/)
📍 Latin America
💡 Aerolab
🌐 [aerolab.co](https://aerolab.co/)
📍 Worldwide
🛫 Aerostrat
🌐 [aerostratsoftware.com](https://aerostratsoftware.com/)
📍 USA
---
🔥 Tip: Save this post to explore all links later!
💬 Comment below which company you’d love to work for 👇
Find your next opportunity at top global companies👇
---
🌐 [careers.google.com](https://careers.google.com/)
📍 USA, Europe, India, Remote
🇺🇸 Amazon
🌐 [amazon.jobs](https://www.amazon.jobs/)
📍 Worldwide
💻 Microsoft
🌐 [careers.microsoft.com](https://careers.microsoft.com/)
📍 Worldwide (Remote-first)
📱 Meta (Facebook, Instagram, WhatsApp)
🌐 [metacareers.com](https://www.metacareers.com/)
📍 Fully Remote
🍎 Apple
🌐 [jobs.apple.com](https://jobs.apple.com/)
📍 Fully Remote
---
💼 GitHub
🌐 [github.com/careers](https://github.com/careers)
📍 USA, Remote
💻 GitLab
🌐 [about.gitlab.com/jobs](https://about.gitlab.com/jobs)
📍 Worldwide (Remote-first)
🌐 Automattic (WordPress)
🌐 [automattic.com/work-with-us](https://automattic.com/work-with-us)
📍 Worldwide (Fully Remote)
⚙️ Zapier
🌐 [zapier.com/jobs](https://zapier.com/jobs)
📍 Worldwide (Fully Remote)
🛍 Shopify
🌐 [shopify.com/careers](https://www.shopify.com/careers)
📍 Canada, USA, Remote-first
🚀 Atlassian
🌐 [atlassian.com/company/careers](https://www.atlassian.com/company/careers)
📍 Worldwide (Remote Options)
---
☁️ Salesforce
🌐 [salesforce.com](https://www.salesforce.com/)
📍 Worldwide
🌐 [redditinc.com/careers](https://www.redditinc.com/careers)
📍 USA, Remote
🧠 Notion
🌐 [notion.so/careers](https://www.notion.so/careers)
📍 USA, Remote
🎨 Canva
🌐 [canva.com/careers](https://www.canva.com/careers)
📍 Australia, Remote
---
🏢 AddStructure
🌐 [bazaarvoice.com](https://www.bazaarvoice.com/)
📍 USA
🌎 Adeva
🌐 [adevait.com](https://adevait.com/)
📍 Asia, Africa, Europe, South America, USA
💼 Adzuna
🌐 [adzuna.co.uk](https://www.adzuna.co.uk/)
📍 Worldwide
🧠 AE Studio
🌐 [ae.studio](https://ae.studio/)
📍 Latin America
💡 Aerolab
🌐 [aerolab.co](https://aerolab.co/)
📍 Worldwide
🛫 Aerostrat
🌐 [aerostratsoftware.com](https://aerostratsoftware.com/)
📍 USA
---
🔥 Tip: Save this post to explore all links later!
💬 Comment below which company you’d love to work for 👇
This media is not supported in your browser
VIEW IN TELEGRAM
🤯 Unlock Remote Access: The VS Code Secret 🤫
90% of developers don't know about this powerful VS Code trick! 🤯
It's called "Forward Port," and it lets you expose your local project (running on localhost) to the entire internet in seconds.
Why You Need It:
- Share instantly with clients or teammates.
- Test easily on real mobile devices.
- No complex setup or external tools needed.
Watch the video above for the quick demo. 🎥
Did you find this helpful? Drop a like! 👍
👉 https://t.me/CodersMantra
90% of developers don't know about this powerful VS Code trick! 🤯
It's called "Forward Port," and it lets you expose your local project (running on localhost) to the entire internet in seconds.
Why You Need It:
- Share instantly with clients or teammates.
- Test easily on real mobile devices.
- No complex setup or external tools needed.
Watch the video above for the quick demo. 🎥
Did you find this helpful? Drop a like! 👍
👉 https://t.me/CodersMantra
❤2
This media is not supported in your browser
VIEW IN TELEGRAM
Finding this website is like discovering a goldmine in 2025 🔥
I've found an impressive resource for generating high-quality AI images: the Perchance AI Text-to-Image Generator.
What makes it remarkable?
• Completely Free & No Sign-Up: Start creating instantly without any barriers.
• Highly Customizable: Choose from various artistic styles and aspect ratios for your creations.
• Unlimited Generations: Explore your ideas without restrictions.
While it's ad-supported, the fact that such a powerful tool is freely available is a fantastic resource for creators.
Try it here: 👉 https://t.me/CodersMantra/159
P.S. If you're interested in more AI tool discoveries and insights, simply comment "AI" below. I'll be sure to share more.
I've found an impressive resource for generating high-quality AI images: the Perchance AI Text-to-Image Generator.
What makes it remarkable?
• Completely Free & No Sign-Up: Start creating instantly without any barriers.
• Highly Customizable: Choose from various artistic styles and aspect ratios for your creations.
• Unlimited Generations: Explore your ideas without restrictions.
While it's ad-supported, the fact that such a powerful tool is freely available is a fantastic resource for creators.
Try it here: 👉 https://t.me/CodersMantra/159
P.S. If you're interested in more AI tool discoveries and insights, simply comment "AI" below. I'll be sure to share more.
Try it here: 👉 perchance.org/ai-text-to-image-generator
perchance.org
AI Image Generator (free, no sign-up, unlimited)
A *fast*, unlimited, no login (ever!!!), AI image generator. Generate large *batches* of images all in just a few seconds. Generate AI art from text, completely free, online, no login or sign-up, no daily credit limits/restrictions/gimmicks, and it's fast.…
❤1
This media is not supported in your browser
VIEW IN TELEGRAM
Swark ek VS Code extension hai jo aapke project ko ek simple aur clear architecture visualization mein badal deta hai.
Isse aap asaani se dekh sakte hain ki codebase mein sab kuch kaise connected hai aur kaise kaam karta hai.
Perfect when you join a new repo or revisit an old one.
Steps to follow:
1. Install the Swark extension
2. Open Command Palette (Ctrl + Shift + P)
3. Search “Swark: Create Architecture Diagram” and click
4. Select the default folder
Hope this helps ✅
Follow 👉 @CodersMantra for more.
Isse aap asaani se dekh sakte hain ki codebase mein sab kuch kaise connected hai aur kaise kaam karta hai.
Perfect when you join a new repo or revisit an old one.
Steps to follow:
1. Install the Swark extension
2. Open Command Palette (Ctrl + Shift + P)
3. Search “Swark: Create Architecture Diagram” and click
4. Select the default folder
Hope this helps ✅
Follow 👉 @CodersMantra for more.
👉 Stop Repeating 'try-catch' in Express
A Simple Pattern for Clean, Scalable Error Handling
A Simple Pattern for Clean, Scalable Error Handling