📊 Yesterday poll answer and explanation - Day 5 console.log(0 && "Hello"); console.log("Hello" && 0) Rule of && in JavaScript (Important ⭐) 👉 It evaluates left to right 👉 It returns the first falsy value, 👉 If no falsy value is found, it returns the last truthy value These are falsy values in JavaScript false, 0, "", null, undefined, NaN 🎯 Final output 0, 0 Hope this explanation is helpful😊 #JavaScript #FrontendDeveloper #WebDevelopment #LearningJavaScript #InterviewPrep
JavaScript && Operator Explanation and Examples
More Relevant Posts
-
📊 Day 6 - poll answer and explanation console.log(0 || "Hello"); console.log("Hello" || 0); Rule of || in JavaScript (Important ⭐) 👉 It evaluates left to right 👉 It returns the first truthy value 👉 If all values are falsy, it returns the last value These are falsy values in JavaScript false, 0, "", null, undefined, NaN 🎯 Final output "Hello" "Hello" Hope this explanation is helpful😊 #JavaScript #JavaScriptTricks #LogicalOperators #JavaScriptInterview #FrontendDevelopment #WebDevelopment #CodingConcepts #LearnJavaScript #DeveloperCommunity #30DaysOfJavaScript #100DaysOfCode #TechCommunity #DailyLearning
To view or add a comment, sign in
-
Javascript challenge! let a = 10; let b = 20; [a, b] = [b, a]; console.log(a, b); Drop your answer in the comments #JavaScript #CodingChallenge #WebDevelopment #FrontendDeveloper #LearnToCode
To view or add a comment, sign in
-
learned about the switch statement in JavaScript. It is used when we need to check multiple conditions. Example: let day = 2; switch(day){ case 1: console.log("Monday"); break; case 2: console.log("Tuesday"); break; default: console.log("Another day"); } Switch statements make code cleaner when handling many conditions. #JavaScript #CodingJourney #FrontendDeveloper
To view or add a comment, sign in
-
-
💻 JavaScript Beginner Level Practice – Count Vowels function countVowels(str){ let vowels = "aeiou"; let count = 0; for(let char of str.toLowerCase()){ if(vowels.includes(char)){ count++; } } return count; } console.log(countVowels("hello world")); 📌 Output: 3 💡 Explanation: This program loops through each character in a string and checks whether it is a vowel (a, e, i, o, u). If it is a vowel, the count increases. #JavaScript #BeginnerLevel #CodingPractice #WebDevelopment
To view or add a comment, sign in
-
-
🧠 JavaScript Async/Await Challenge What will be the output? async function test() { console.log("1"); await Promise.resolve(); console.log("2"); } console.log("3"); test(); console.log("4"); Options: A) 3 1 2 4 B) 3 1 4 2 C) 1 3 4 2 D) 3 4 1 2 What do you think the output will be? 👀 #javascript #frontenddeveloper #webdevelopment #codingchallenge
To view or add a comment, sign in
-
💻 JavaScript Beginner Level Practice – Reverse String Today I practiced a simple JavaScript program to reverse a string. function reverseString(str){ return str.split("").reverse().join(""); } console.log(reverseString("hello")); 📌 Output: olleh 💡 Explanation: This program reverses a string using "split()", "reverse()", and "join()" methods. Input: hello Output: olleh #JavaScript #CodingPractice #WebDevelopment #LearningToCode
To view or add a comment, sign in
-
-
I learned about the rest operator in JavaScript. When a function can receive an unknown number of arguments, we can use the rest operator (...). We define the known parameters first, and then use ... with one parameter to collect the remaining arguments. All extra arguments are stored inside that rest parameter as an array. A simple but powerful feature that makes functions more flexible. #JavaScript #ES6 #RestOperator #Functions #WebDevelopment #LearningJourney
To view or add a comment, sign in
-
🤯 JavaScript did WHAT here?! const str = "1,2,3" const arr = [1,2,3] console.log(arr == str) // true 😳 console.log(arr === str) // false 🤔 Same data… different results? This is exactly why many developers get confused between == and ===. 👉 How did an array become equal to a string? 👉 Why does strict equality behave differently? 👉 And when should you actually use each? I break this down in a simple way in my latest video 🎥 If you've ever been surprised by JavaScript comparisons, this one's for you. #JavaScript #WebDevelopment #Frontend #CodingTips #LearnToCode
To view or add a comment, sign in
-
🚀 Day 29 - 💡 JavaScript Tricky Question Explanation let a = [1,2,3]; delete a[1]; console.log(a); console.log(a.length); 👉 Output: ``` [1, empty, 3] 3 ``` 👉 Explanation: * `delete` removes the value but does NOT reindex the array * It creates a hole (empty slot) instead of shifting elements * So, `length` remains 3 ⚠️ Use `splice()` if you want to remove and shift elements #JavaScript #WebDevelopment #Frontend #CodingInterview #JSConcepts
To view or add a comment, sign in
-
Advanced Tip: Use 'Function Nodes' in n8n to write custom JavaScript and extend your power. 💻⚖️ When pre-built nodes aren't enough, code your way to victory. Get the JS snippets for n8n at smartflowslab.com. #n8nTutorial #JavaScript #AdvancedNoCode #AutomationStrategy
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