**JavaScript Truthy vs Falsy (Easy Trick)** **Falsy values (only 6):** `false`, `0`, `""`, `null`, `undefined`, `NaN` **Everything else is Truthy** If a value is *not one of these 6*, JavaScript treats it as *true* in conditions. #JavaScript #WebDevelopment #CodingTips
JavaScript Truthy Falsy Values
More Relevant Posts
-
Got a minute for some JavaScript? 🍒 What does this code output? Answers 🔍 >>> - "Tom says meow" - TypeError: c.createKitten is not a function - "Kitty says meow" Why the TypeError? *createKitten* is a static method - it lives on the *Cat* constructor, not on instances. *c* is an instance, so it cannot access static methods. Only *Cat.createKitten()* works. #javascript #webdevelopment
To view or add a comment, sign in
-
-
💡 JavaScript Trick Question: 3 + 2 + "7" In JavaScript, the answer is: 👉 "57" 🔍 Why? 🔹 JavaScript follows left-to-right evaluation and uses type coercion. ⚡ Key Insight : 🔹Once a string enters the expression, everything after that becomes a string operation. "In JavaScript, the moment a string joins the party, numbers stop adding and start concatenating." #JavaScript #WebDevelopment #CodingInterview #Frontend #JSConcepts
To view or add a comment, sign in
-
-
This is an awesome repository for JavaScript devs! 🔥 33-js-concepts provides the perfect roadmap, packed with resources, articles, and videos, to help you master the 33 most important concepts every JavaScript developer needs to know. Link 🔗: https://lnkd.in/g7epZMe2 Hope this helps ✅ Do Like 👍 & Repost 🔄 #html #css #javascript #typescript #react #viral
To view or add a comment, sign in
-
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
To view or add a comment, sign in
-
-
Got a minute for some JavaScript? 🍵 What does this code output? Answers 🔍 >>> - ReferenceError: message is not defined Why? Because let lives only inside the block where it’s created. In this code, message is created inside the *if {}* and *else {}* blocks. When JavaScript reaches *console.log(message)*, it is already outside those blocks, so the variable no longer exists. #javascript #webdevelopment
To view or add a comment, sign in
-
-
⚡ JavaScript Performance Tip: Debounce vs Throttle Debounce → Runs after the delay Throttle → Runs every fixed interval #javascript #frontenddevelopment #reactjs #webperformance #webdevelopment
To view or add a comment, sign in
-
-
0ms Delay... but what about the extra arguments? 🧐 Most developers know setTimeout(callback, delay), but did you know you can pass arguments directly into the callback? #JavaScript #WebDevelopment #CodingQuiz #SoftwareEngineering #FrontendTips
To view or add a comment, sign in
-
In JavaScript, == and === are both comparison operators — but they behave differently. == → Compares values === → Compares both value and type Example: 5 == "5" → true 5 === "5" → false For cleaner and more predictable code, always prefer === ✅ #JavaScript #WebDevelopment #CodingTips
To view or add a comment, sign in
-
-
JavascriptLogic#15 — Check Anagram Two words are anagrams if they have the same letters in a different order. Example: listen - silent ✅ Both have the same letters. hello - world ❌ Different letters. JavaScript Code: ➡ breaks the word into letters Example listen → ["l","i","s","t","e","n"] sort() ➡ arranges letters in order join("") ➡ joins letters back into a word So both words become the same after sorting. If both words are equal, they are anagrams. #JavaScript #CodingPractice #LearningJourney
To view or add a comment, sign in
-
-
𝐖𝐡𝐞𝐧𝐞𝐯𝐞𝐫 𝐲𝐨𝐮 𝐝𝐨 𝐃𝐎𝐌 𝐦𝐚𝐧𝐢𝐩𝐮𝐥𝐚𝐭𝐢𝐨𝐧 𝐢𝐧 𝐉𝐚𝐯𝐚𝐒𝐜𝐫𝐢𝐩𝐭, 𝐫𝐞𝐦𝐞𝐦𝐛𝐞𝐫 𝐭𝐡𝐢𝐬 👇 If you have: <p id="text">Hello</p> This might work: text.style.color = "yellow"; 👉 But don’t rely on it ❌ Some browsers treat id as a global variable, but this is not reliable. ✅ Always use: document.getElementById("text") 💡 Rule: Write code that works everywhere, not just sometimes #JavaScript #FrontendDevelopment #WebDevelopment #SDE
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