🚀 JavaScript Quiz Time 🧠 | Can You Find the Output? I came across an interesting JavaScript puzzle today 👇 let x = ? let y = ? let z = ((x * y) < (x + y) && (x + y) < (x - y)) console.log(`z = ${z}`) 🤔 Challenge: Can you find values of x and y such that the output z = true? ✨ Hint: Think about how multiplication, addition, and subtraction behave with negative numbers. 💡 What I learned: ✅ Logical operators (&&) evaluation ✅ Comparing expressions in JavaScript ✅ Importance of choosing correct values ✅ Problem-solving with conditions 🔥 One possible answer: let x = -1 let y = 2 Try more combinations and see how the result changes! Let me know your answers in the comments 👇 #JavaScript #CodingChallenge #ProblemSolving #WebDevelopment #LearningInPublic #coddy #100DaysOfCode #Developers
JavaScript Puzzle: Logical Operators and Expression Evaluation
More Relevant Posts
-
📚 What I Studied Today – JavaScript Functions & Array Methods Today I strengthened my understanding of some core JavaScript concepts: 🔹 Functions A function is a block of code written once and reused multiple times to perform a specific task. 🔹 Function Definition vs Call - Function Definition: Declares a function with parameters - Function Call: Executes the function using arguments 👉 Parameters = values inside () in definition 👉 Arguments = values inside () in call 🔹 Important Concepts - Parameters act like local variables (accessible only inside the function) - Functions help reduce redundancy (avoid repeating code) - Arrow functions provide a shorter syntax using "=>" 🔹 Callbacks & Higher Order Functions - A callback function is passed as an argument to another function - "forEach()" is a higher order method because it takes a function as input 🔹 Array Methods - "map()" → transforms each element into a new array - "filter()" → selects elements based on a condition - "reduce()" → reduces array to a single value (sum, total, etc.) 🚀 Slowly building a strong foundation in JavaScript! #JavaScript #WebDevelopment #CodingJourney #Learning #MERN
To view or add a comment, sign in
-
-
🚀 Learning JavaScript? Start with Strings. Strings are one of the most used things in JavaScript. If you can work with text, you can build forms, messages, search features, and much more. Let’s understand the basics 👇 • Create a string using quotes let name = "JavaScript"; • Find string length name.length • Join strings together "Hello " + "World" • Change text case name.toUpperCase() or name.toLowerCase() • Get part of a string name.substring(0,4) Small concept… but used everywhere in real projects. Master the basics → coding becomes easier. #JavaScript #WebDevelopment #FrontendDevelopment #LearnToCode #ProgrammingBasics #JavaScriptTips #CodingForBeginners #DeveloperCommunity #TechEducation #SoftwareDevelopment
To view or add a comment, sign in
-
-
JavaScript fun facts that sound fake but are actually real: - "typeof null" → ""object"" (this is a bug from early JS that was never fixed) --- - "[] + []" → """" (empty string) --- - "[] + {}" → ""[object Object]"" --- - "{} + []" → "0" (yes… seriously) --- - "NaN === NaN" → "false" (the only value not equal to itself) --- - "0.1 + 0.2 !== 0.3" (floating point precision issue) --- - Functions are objects in JavaScript → you can add properties to them --- - JavaScript is single-threaded → but still handles async like a pro using event loop --- - "setTimeout(fn, 0)" does NOT run immediately → it runs after the call stack is empty --- If JavaScript ever feels weird, it’s not you. It’s JavaScript. Still learning, still questioning. #JavaScript #WebDevelopment #FrontendDevelopment #Programming #Developers #CodingJourney #TechFacts #BuildInPublic
To view or add a comment, sign in
-
-
🚀✨ Today's JavaScript Practice: Strengthening My Fundamentals! ✨🚀 ✨I dedicated some time today to revise and practice core JavaScript concepts. Here's a quick summary of what I worked on 👇 🔹 Primitive Datatypes Created and printed variables using different primitive types like string, number, boolean, undefined, and null. 🔹 Type Conversion Practiced converting a string to a number and vice versa using Number() and String(). 🔹 Objects Stored a person's details using an object and printed the data. 🔹 Even or Odd Checker Built a program to check whether a number is even or odd using multiple approaches. 🔹 Grade Calculator Developed a program using if-else and switch statements to calculate grades based on marks and display results accordingly. 💡 Key Learnings: Strengthened my understanding of variables and datatypes Improved logic building with conditionals and loops Practiced real-time input handling and validation Gained confidence in writing small JavaScript programs Consistency is the key to mastering programming 💪 ✨ #JavaScript #WebDevelopment #Coding #FrontendDevelopment #LearnToCode #Programming ✨
To view or add a comment, sign in
-
Day 2 of My JavaScript Journey 🚀 Today, I learned about values and variables in JavaScript. Values are the most fundamental unit of information in programming. Everything in JavaScript is built around values; numbers, text, true/false, etc. Variables, on the other hand, are like containers (or boxes) used to store these values so they can be reused later in a program. For example: let age = 20; Here, "20" is the value, and "age" is the variable storing it. One simple way to understand it: Values = the data Variables = where the data is stored Key takeaway: Variables make it easier to manage and reuse data efficiently in your code. I’m documenting my journey daily as I grow in JavaScript. #JavaScript #WebDevelopment #LearningInPublic #100DaysOfCode
To view or add a comment, sign in
-
Day 20 of my JavaScript journey 🚀 Built a Password Generator with advanced features using HTML, CSS, and JavaScript. Features: 🔐 Custom password length (8–20 characters) 🔤 Include/exclude uppercase, lowercase, numbers, and symbols 📋 One-click copy to clipboard 📊 Password strength indicator This project helped me dive deeper into logic building, user input handling, and creating practical tools. 💻 GitHub Repo: https://lnkd.in/g7kFznGK Focused on building projects that are not just functional, but actually useful. 💻 #JavaScript #WebDevelopment #FrontendDeveloper #100DaysOfCode #CodingJourney
To view or add a comment, sign in
-
💥 JavaScript: Where Logic Goes to Die 🤯 Think you understand JavaScript? These mind-bending quirks might change your mind… ⚡ Ever wondered: 👉 Why 9999999999999999 becomes 10000000000000000? 👉 Why 1 < 2 < 3 is true, but 3 > 2 > 1 is false? 👉 Why [] == false is true but [] === false is false? 🧠 Welcome to the world of: ✔️ Type Coercion ✔️ Floating Point Precision ✔️ Weird Comparisons ✔️ Truthy vs Falsy Values 💡 For example (from page 9): 0.1 + 0.2 === 0.3 → ❌ false Because JavaScript uses floating-point math, resulting in 0.30000000000000004 😂 And the classic: 'b' + 'a' + + 'a' + 'a' → “banana” (sort of 😅) 🚀 These aren’t bugs — they’re how JavaScript actually works! 📌 If you're a developer, mastering these quirks will save you from real-world bugs. 💬 Which one shocked you the most? #JavaScript #WebDevelopment #Coding #JS #Frontend #Programming #Developers #CodingLife
To view or add a comment, sign in
-
🚀 JavaScript Concepts Series – Day 6 / 30 📌 Closures in JavaScript 👀 Let’s Revise the Basics 🧐 A closure is when a function remembers variables from its outer scope even after the outer function has finished execution. 🔹 Key Points • Inner function can access outer variables • Data persists even after function execution • Useful for data privacy and state management 🔹 Example function outer() { let count = 0; return function inner() { count++; console.log(count); }; } const counter = outer(); counter(); // 1 counter(); // 2 💡 Key Insight Closure → Function + its lexical scope Remembers → Outer variables after execution Closures are widely used in callbacks, event handlers, and React hooks. More JavaScript concepts coming soon. 🚀 #javascript #js #webdevelopment #frontenddeveloper #coding #programming #developers #softwaredeveloper #learnjavascript #javascriptdeveloper #codinglife #devcommunity #webdev #reactjs #mernstack #codingjourney #codeeveryday #developerlife #100daysofcode #techlearning
To view or add a comment, sign in
-
-
Javascript: Quotes in strings ⚠️ A small mistake with quotes can break your JavaScript code. Many beginners face this problem when working with strings. In JavaScript, quotes are used to create text. But using the wrong quote inside a string can cause an error. Here are the basics 👇 • Use single quotes let text = 'Hello World'; • Use double quotes let text = "Hello World"; • Use backticks (template strings) let text = `Hello World`; • Use different quotes inside a string "I'm learning JavaScript" • Escape quotes if needed 'It\'s JavaScript' Learning this small concept will save you from many syntax errors. #JavaScript #WebDevelopment #FrontendDevelopment #LearnJavaScript #CodingForBeginners #ProgrammingTips #SoftwareDevelopment #TechLearning #DeveloperSkills #CodeNewbie
To view or add a comment, sign in
-
-
You don’t need 100 JavaScript concepts. You need these 14. Seriously. Most beginners jump from tutorial to tutorial… but still struggle with real problems. The reason? They ignore the basics that actually matter. These 14 Array Methods alone can level up your JavaScript: • push() / pop() • shift() / unshift() • slice() / splice() • map() / filter() / reduce() • forEach() • find() / findIndex() • includes() / sort() Once you understand these properly: → Your logic improves → Your code becomes cleaner → Interviews feel easier No fancy tricks. Just strong fundamentals. I use these almost every day while building projects. And honestly… This is where real confidence comes from. 📌 Save this — you’ll thank yourself later 📌 Share with a developer who needs this Want simple explanations + examples for each? Comment “ARRAY” — I’ll send you everything I use. #javascript #frontenddeveloper #webdevelopment #mernstack #reactjs #coding #programming #learnincode
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