📊 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
JavaScript || Operator Explanation with Example
More Relevant Posts
-
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
-
🚀 30 Days of JavaScript – Day 10 Today I built a small logical puzzle game called Bulls & Cows. The program generates a secret number and the player must guess it. After each guess, the program gives hints using Bulls (correct digit & position) and Cows (correct digit but wrong position). 🧠 Concepts Used: • loops • string indexing • conditional logic • problem-solving approach 🎥 Demo below 👇 Full source code in the comments. #JavaScript #CodingChallenge #ProblemSolving #WebDevelopment #LearningJavaScript
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
-
-
🚀 30 Days of JavaScript – Day 12 Can you solve these number puzzles? 🤔 Today I built a small JavaScript program that asks 3 number pattern questions and calculates the final score. 🧠 Concepts Used: conditional statements user input with prompt() variables and score tracking 🎥 Demo below 👇 Full source code in the First comment. #JavaScript #CodingChallenge #ProblemSolving #LearningJavaScript #WebDevelopment
To view or add a comment, sign in
-
> Day 12/21 : JavaScript Control Flow As part of my 21-Day Full Stack Revision Challenge, today I revised control flow in JavaScript, which helps programs make decisions and repeat tasks. Control flow is important because it allows the program to execute different actions based on conditions. > Topics I Covered If–Else Statements – Used to execute code based on conditions Switch Statements – A cleaner way to handle multiple conditions Loops – Used to repeat a block of code multiple times > Why It Matters Control flow helps developers build logical and dynamic programs by controlling how and when code runs. Day 12 completed #FullStackDeveloper #JavaScript #WebDevelopment #LearningInPublic #21DaysChallenge #CodingJourney
To view or add a comment, sign in
-
JavaScript bugs don’t just break the code… they create new dimensions of problems. 😅 Every error feels like a puzzle no one prepared you for. #JavaScript #CodingMemes #DeveloperLife #WebDevelopment
To view or add a comment, sign in
-
-
Day 12 #100DaysOfCode 💻 Today I learned about Synchronous vs Asynchronous JavaScript, especially how setTimeout() and setInterval() work. JavaScript runs code synchronously by default (line by line). But functions like "setTimeout()" run asynchronously, meaning they execute later without blocking the main thread. Example: console.log("1"); setTimeout(() => { console.log("2"); }, 0); console.log("3"); Output: 1 3 2 Even with "0ms", "setTimeout" goes to the callback queue, so the synchronous code runs first. Understanding this concept helped me see how JavaScript handles non-blocking tasks. #JavaScript #AsyncJavaScript #WebDevelopment #CodingJourney #Akbiplob
To view or add a comment, sign in
-
Day 11 #100DaysOfCode 💻 Today I learned about Higher Order Functions and Callback Functions in JavaScript. A Higher Order Function is a function that takes another function as a parameter. A Callback Function is the function that is passed and executed later. This concept helps make code more flexible and reusable. Example: function square(n) { console.log(n * n); } function higherOrderFunction(num, callback) { callback(num); } higherOrderFunction(6, square); ★Output: 36 Understanding how functions can be passed as arguments is an important step toward learning asynchronous JavaScript. #JavaScript #WebDevelopment #CodingJourney #Akbiplob
To view or add a comment, sign in
-
💻 JavaScript Beginner Level Practice – Factorial Program Today I practiced a JavaScript program to calculate the factorial of a number using recursion. function factorial(n){ if(n === 0 || n === 1){ return 1; } return n * factorial(n - 1); } console.log(factorial(5)); 📌 Output: 120 💡 Explanation: Factorial means multiplying all whole numbers from 1 to the given number. Example: 5! = 5 × 4 × 3 × 2 × 1 = 120. #JavaScript #BeginnerLevel #CodingPractice #WebDevelopment #LearningToCode
To view or add a comment, sign in
-
-
💡 JavaScript Tip for Developers One of the most common sources of confusion in JavaScript is the difference between == and ===. == performs type coercion, meaning it converts values before comparing. === performs strict comparison, checking both value and type. Example: 0 == false → true 0 === false → false Understanding this difference helps avoid hidden bugs and unexpected behavior in applications. 🎥 I created a 3-minute video explaining the comparison clearly with examples. https://lnkd.in/gQpg2aGp Watch it and strengthen your JavaScript fundamentals. #JavaScript #Programming #WebDevelopment #Frontend #CodingTips
== vs === in JavaScript – Comparison That Confuses Developers (With Examples)
https://www.youtube.com/
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