💻 JavaScript Conditional Statements (If-Else, Else If, Switch & Ternary) In today’s practice, I explored how JavaScript makes decisions using conditional statements. These help programs respond differently based on input or conditions — just like real-life choices! 🌟 🧩 Covered Concepts: ✅ If–Else: Checking even/odd numbers, eligibility, positive/negative, passwords, divisibility 🧠 Else–If Ladder: Grades, largest number, months, temperature, character types 🔁 Switch Case: Days, seasons, calculator, traffic lights, grades ⚡ Ternary Operator: Quick checks for positivity, largest number, leap year, pass/fail, and case 💬 Practicing these statements improved my logic-building and problem-solving skills in JavaScript! #JavaScript #WebDevelopment #CodingPractice #FrontendDevelopment #LearnToCode #ProgrammingJourney
More Relevant Posts
-
🚀 Day 4 of My 30 Days of JavaScript Journey ✅ Challenge: Create Counter Object (LeetCode #2665) Write a function createCounter(init) that returns an object with three functions: increment() → increases the value by 1 and returns it. decrement() → decreases the value by 1 and returns it. reset() → resets the value to the initial value and returns it. 💻 Language Used: JavaScript ❓ Problem Link: https://lnkd.in/gKxPxb8Y 💡 Solution: https://lnkd.in/g3jv6Nfi 🧠 Concept Highlighted: This challenge strengthens understanding of closures and object methods in JavaScript. It shows how functions can preserve and modify internal state — a key concept in building dynamic, stateful applications. #JavaScript #LeetCode #30DaysOfCode #CodingChallenge #WebDevelopment #FrontendDevelopment #LearningEveryday #Closures #ProblemSolving
To view or add a comment, sign in
-
🚀 Day 4 of My 30 Days of JavaScript Challenge 🧩 Problem: Create Counter II (LeetCode #2665) Write a function createCounter(init) that returns an object with three functions: increment() → increases the current value by 1 and returns it decrement() → decreases the current value by 1 and returns it reset() → resets the value back to init and returns it 💻 Language: JavaScript ❓ Question: https://lnkd.in/eupkr-a3 💡 Solution: https://lnkd.in/eq3BEsn2 🧠 Concepts Used: Closures for maintaining private state across function calls Object methods to encapsulate multiple related actions State management inside functions 📚 Takeaway: This challenge reinforces closures and encapsulation — two powerful ideas that make JavaScript functions behave like real objects with memory and behavior. #Day4 #JavaScript #30DaysOfCode #LeetCode #CodingChallenge #WebDevelopment #FrontendDevelopment #100DaysOfCode
To view or add a comment, sign in
-
🚀 Day 10 of My 30 Days of JavaScript Challenge 🧩 Problem: Allow One Function Call (LeetCode #2666) Given a function fn, return a new function that ensures fn can only be called once. The first call returns the actual result, and every subsequent call returns undefined. 💻 Language: JavaScript 📖 Problem Link: https://lnkd.in/epnrfahZ 💡 Solution: https://lnkd.in/eGQKWkEk 🧠 Concepts Used Closures to store state (whether function is already called) Function Wrapping Higher-Order Functions 📚 Takeaway This problem is a great example of how closures preserve state between function calls — an essential concept for: Memoization API rate-limiting Event listener control #Day10 #JavaScript #30DaysOfCode #LeetCode #WebDevelopment #CodingChallenge #Closures #FrontendDevelopment #100DaysOfCode
To view or add a comment, sign in
-
🚀 JavaScript Revision Series — Day 3 Today’s revision was all about Operators in JavaScript — the tools that let us do everything from math to logic in our programs! 💻✨ 🟢 Operators Covered: Arithmetic: + - * / % Assignment: =, +=, -=, *= Logical: &&, ||, ! Ternary Operator: condition ? true : false 😄 Fun JS Moment: Remember, 5 + "1" = "51" But 5 - "1" = 4 JS loves to play tricks with operators 😅 --- 🔗 Daily Practice Repo: https://lnkd.in/ejQk84Zg Step by step, one operator at a time — building solid JS foundations! 🚀 #JavaScript #JavaScriptBasics #LearningJourney #WebDevelopment #FrontendDevelopment #CodingJourney #MERNStack #ConsistencyIsKey #SMIT #DeveloperCommunity #Saylani
To view or add a comment, sign in
-
-
The JavaScript reduce() method is a powerful tool to process arrays and return a single value. It takes a reducer function, which combines every array element into one result using an accumulator. For example, you can sum numbers or count occurrences easily with reduce(). It’s perfect for transforming and accumulating data efficiently. Quick example: javascript const numbers = [1, 2, 3, 4]; const sum = numbers.reduce((acc, curr) => acc + curr, 0); console.log(sum); // Output: 10 Try to master this method to level up your coding skills! #JavaScript #WebDev #CodingShorts #ArrayMethods
To view or add a comment, sign in
-
📒Today I explored an interesting JavaScript concept: Floating -Point Precision Errors. If you've ever tried: 0.1+0.2 === 0.3 // false It can feel confusing at first. But this happens because JS uses binary floating-point numbers, which cannot represent certain decimal values precisely. But solution is here: To handle these tiny precision issues, JS provides:- Number.EPSILON The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 that is representable as a Number value, which is approximately: 2.2204460492503130808472633361816 x 10−16. Developers often use it to compare decimal values safely. Learning about this helped me understand why precision matters in JavaScript and how to write more reliable code. To make it more understandable, I also made a tinny project called 'Floating point checker'. Code snippet is below here. Step by step, I am getting more confident with JS fundamentals. #JavaScript #WebDevelopment #StayLearning
To view or add a comment, sign in
-
-
🚀 Day 6 of My 30 Days of JavaScript Challenge 🧩 Problem: Filter Elements from Array (LeetCode #2634) Given an integer array arr and a filtering function fn, return a new array filteredArr that only includes elements where fn(arr[i], i) returns a truthy value. Solve this without using the built-in Array.filter() method. 💻 Language: JavaScript ❓ Question: https://lnkd.in/eSGpgXcM 💡 Solution: https://lnkd.in/ekA6y-u3 🧠 Concepts Used: Higher-order functions and callbacks Conditional checks for truthy/falsy values Understanding Boolean(value) behavior in JavaScript 📚 Takeaway: Rebuilding filter() from scratch deepens understanding of conditional logic, iteration, and truthy/falsy evaluation — all essential for functional programming in JavaScript. #Day6 #JavaScript #30DaysOfCode #LeetCode #CodingChallenge #WebDevelopment #FrontendDevelopment #100DaysOfCode
To view or add a comment, sign in
-
🚀 Day 5 of My 30 Days of JavaScript Challenge 🧩 Problem: Apply Transform Over Each Element in Array (LeetCode #2635) Given an integer array arr and a mapping function fn, return a new array such that: newArray[i] = fn(arr[i], i) Solve this without using the built-in Array.map() method. 💻 Language: JavaScript ❓ Question: https://lnkd.in/eq8qYfpb 💡 Solution: https://lnkd.in/eT5U2kBp 🧠 Concepts Used: Higher-order functions (passing functions as arguments) Loops and callback functions Core idea behind how .map() works internally 📚 Takeaway: By recreating the Array.map() method manually, I learned how callback execution and array transformations work under the hood — a must-know for mastering JavaScript fundamentals. #Day5 #JavaScript #30DaysOfCode #LeetCode #CodingChallenge #WebDevelopment #FrontendDevelopment #100DaysOfCode
To view or add a comment, sign in
-
Building a Basic Calculator in JavaScript 🔹 Ever wondered how to evaluate a math expression like '1 + (4 + 5 + 2) - 3' in JavaScript without using eval()? Here's a clean way to do it using stacks. Key Concepts: Stack for previous results and signs: Keeps track of nested parentheses. Sign management: Helps handle + and - correctly. Iterative parsing: Converts string digits into numbers. Avoids the dangers of eval(). Can handle nested parentheses. Shows how stack-based algorithms can solve real-world problems elegantly.
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
Excellent Work