Day 10 of 100 🎉 — Double digits!! In JavaScript, there is ONE value that is NOT equal to itself. Not a bug. Not a mistake. It's by design. 😱 Comment down 👇 5 lines — 5 answers! Hint: Its name literally says "Not a Number" — yet typeof says it IS a number. And isNaN vs Number.isNaN behave differently too. This one has LAYERS! 🧅 Full explanation in the comments tonight! #100DaysOfCode #JavaScript #CodingInterview #JavaScriptTips #WebDevelopment
JavaScript's Not a Number Conundrum
More Relevant Posts
-
One thing that used to confuse me in JavaScript: Why do both == and === even exist? Coming from other languages, it felt unnecessary. Turns out, they solve two different problems. == tries to be flexible and converts values: 0 == "0" → true === is strict, no conversion: 0 === "0" → false So it’s not random. It’s just two different rules: flexible vs exact. Most of the time, you just want exact. #javascript #webdevelopment
To view or add a comment, sign in
-
JavaScript: Mirror Distance Problem Day 5 👈 Goal: Find the mirror distance of a number — the absolute difference between the number and its reversed form. Approach: Reverse the given number using modulo (%) and division. Subtract the reversed number from the original. Take the absolute value to ensure a positive result. Example: Input: 123 Reversed: 321 Mirror Distance: |123 - 321| = 198 #JavaScript #TypeScript #DSA #CodingInterview #ProblemSolving #FrontendDevelopment #Developers #100DaysOfCode
To view or add a comment, sign in
-
-
Stop using || for your Boolean defaults! 🛑 Ever passed false to a function, only to have your code treat it as true? This is a classic JavaScript "falsy" trap. Because false is a falsy value, the logical OR operator (||) skips right over it and grabs your default value instead. The Fix: Use the Nullish Coalescing operator (??). It’s specifically designed to respect false and 0 while still providing a fallback for null or undefined. Check out the snippet below to see the difference! 👇 Have you made the switch to ?? yet, or do you still find yourself reaching for || ? Follow Wisdom Lamodot for more on #JavaScript #WebDevelopment #CodingTips #ReactJS
To view or add a comment, sign in
-
-
JavaScript tricks I use all the time 👇 Save this 📌 ✅ Optional chaining user?.profile?.name ✅ Nullish coalescing const value = input ?? "default" ✅ Remove duplicates const unique = [...new Set(arr)] ✅ Short condition isLoggedIn && doSomething() ✅ Object destructuring const { name, age } = user 💡 Small JS tricks = cleaner + faster code What’s one JS trick you use daily? #JavaScript #TypeScript #Developers #WebDevelopment #Coding
To view or add a comment, sign in
-
-
JavaScript tricks I use all the time 👇 Save this 📌 ✅ Optional chaining user?.profile?.name ✅ Nullish coalescing const value = input ?? "default" ✅ Remove duplicates const unique = [...new Set(arr)] ✅ Short condition isLoggedIn && doSomething() ✅ Object destructuring const { name, age } = user 💡 Small JS tricks = cleaner + faster code What’s one JS trick you use daily? #JavaScript #TypeScript #Developers #WebDevelopment #Coding
To view or add a comment, sign in
-
-
🚀 Day 979 of #1000DaysOfCode ✨ 4 Useful Number Functions in JavaScript (With Cool Examples) JavaScript provides many built-in number utilities — but most developers only use a few of them. In today’s post, I’ve shared 4 super useful number functions in JavaScript along with some cool and practical examples for each. These functions can help you handle number validation, formatting, and edge cases more effectively in real-world applications. Small utilities like these might look simple, but they can save you time and help you write cleaner and more reliable logic. Once you start using them properly, you’ll notice how often they come in handy while working with data. If you work with numbers, calculations, or user inputs in JavaScript, these functions are definitely worth knowing. 👇 Which JavaScript number function do you use the most in your projects? #Day979 #learningoftheday #1000daysofcodingchallenge #FrontendDevelopment #WebDevelopment #JavaScript #React #CodingCommunity #JSDevelopers
To view or add a comment, sign in
-
The WTF JS GitHub repository is a hilarious yet insightful collection of JavaScript quirks and WTF moments. Learn and laugh while uncovering the language's weird side! 🔥 Link 🔗: https://lnkd.in/dWYWQmfB I hope this helps ✅ Do Like 👍 & Repost 🔄 #html #css #javascript #typescript #react #viral
To view or add a comment, sign in
-
**AVOID JAVASCRIPT'S QUIET BUGS:** **Don't use ==, use ===** --- 🔺 **THE PROBLEM: == COERCION** ```js console.log([] == false); // prints true! 😅 ``` **The behind-the-scenes journey:** ``` [] ↓ (empty array) "" ↓ (string) 0 ↓ (number) false ↓ (boolean) 0 ``` Wait, why is that true? JavaScript silently converts types, leading to unexpected results. **This is confusing behavior!** --- 🔺 **THE FIX: STRICT EQUALITY** ```js console.log([] === false); // prints false! 🎉 ``` Uses strict comparison without hidden type conversions. **Predictable and safe.** --- 🔺 **NO HIDDEN CONVERSION!** --- **MAKING YOUR CODE PREDICTABLE: ALWAYS USE ===** Have you encountered confusing JavaScript type coercion? Share your experience! 👇 #javascript #webdevelopment #frontend #coding #developers #mern #learning
To view or add a comment, sign in
-
-
JavaScript Promise chaining vs async/await: Promise chains: → Harder to read → Error handling complex → Callback-ish Async/await: → Reads like sync code → try/catch works naturally → Easier debugging The choice is obvious. #JavaScript #AsyncJS #CleanCode
To view or add a comment, sign in
-
🎡 JavaScript Event Loop — Quick Challenge Most developers get this wrong 👀 🧪 What will be the output of this code? (Check the image 👇) 👉 Drop your answer in the comments before scrolling. ⏳ Think first... . . . ✅ Answer 1. Start 4. End 3. Promise.then (Microtask) 2. setTimeout (Macrotask) 🔍 Simple Explanation JavaScript runs code in this order: 1️⃣ First → Normal (synchronous) code 2️⃣ Then → All Promises (Microtasks) 3️⃣ Finally → setTimeout (Macrotasks) 👉 Even if setTimeout is 0, it still runs later. 🧠 Takeaway Promise.then → runs sooner setTimeout → runs later Simple rule, but super useful in real projects. 💬 What was your answer? #JavaScript #EventLoop #Frontend #WebDevelopment #CodingTips
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development