This was a really satisfying JavaScript exercise 👇 I worked on a deepEqual function that compares two values and checks if they’re truly equal — including nested objects. What made this exercise special is that it forced me to actually understand recursion, not just memorize it. 🔑 Key insight: If a value can contain itself (objects inside objects), recursion is often the cleanest solution. I also ran into classic JavaScript quirks like: typeof null === "object" Why === doesn’t work for object comparison I made the solution public with comments here: 🔗 [https://lnkd.in/eEXeWgi2] If you’re learning JS, I highly recommend trying this exercise yourself before checking solutions. #JavaScript #FrontendDevelopment #LearningInPublic #WebDevelopment
DeepEqual Function Exercise in JavaScript
More Relevant Posts
-
JavaScript Prototype Inheritance – Explained Simply In JavaScript, objects can learn from other objects through a mechanism known as Prototype Inheritance. When an object lacks a property or method, JavaScript looks up to its prototype to find it. Think of it like this: - A student asks a question. - If they don’t know the answer, they ask their teacher. - If the teacher doesn’t know, it goes further up. This step-by-step lookup is referred to as the Prototype Chain. Key Ideas in Simple Words: - Every JavaScript object has a hidden link called __proto__. - __proto__ points to another object (its prototype). - JavaScript searches from child → parent → Object → null. - This mechanism avoids repeating code and saves memory. - This is how JavaScript supports inheritance without classes. #JavaScript #PrototypeInheritance #JavaScriptBasics #WebDevelopment #FrontendDevelopment #LearnJavaScript #ProgrammingConcepts #CodingForBeginners #SoftwareEngineering #DeveloperCommunity
To view or add a comment, sign in
-
-
JavaScript Variables are used to store data. In modern JavaScript, you should mainly use: ✅ let – when the value can change ✅ const – when the value should stay fixed ❌ Avoid using var because of scope issues. Understanding variables clearly is the foundation for writing clean and bug-free JavaScript code. I explain JavaScript concepts daily and apply them using real projects on my YouTube channel “Code Hunter Sharath”. 🎥 Playlist: 52 Weeks • 52 JavaScript Projects 👍 Follow me for daily JavaScript concepts 🔔 Subscribe to learn by building https://lnkd.in/gq6r6-8b #JavaScript #LearnJavaScript #WebDevelopment #FrontendDeveloper #Coding #Day2of30DaysConcept
To view or add a comment, sign in
-
-
JavaScript Hoisting — explained simply 🧠⬆️ Hoisting is one of the most confusing JavaScript topics, but the idea is actually very simple. Before executing code, JavaScript: ✔ Scans the file ✔ Allocates memory for variables and functions Important points: • Function declarations are fully hoisted • var is hoisted but initialized as undefined • let & const are hoisted but not accessible (TDZ) Simple rule to remember: Hoisting moves declarations to the top, not values. Understanding hoisting helps avoid “undefined” and reference errors 🚀 #javascript #frontenddeveloper #webdevelopment #coding #learningjavascript #reactjs #softwareengineering
To view or add a comment, sign in
-
-
🚀 𝗡𝗲𝘄 𝗕𝗹𝗼𝗴 𝗪𝗵𝗮𝘁 𝗶𝘀 𝘁𝗵𝗲 𝗗𝗢𝗠? 𝗛𝗼𝘄 𝗝𝗮𝘃𝗮𝗦𝗰𝗿𝗶𝗽𝘁 𝗜𝗻𝘁𝗲𝗿𝗮𝗰𝘁𝘀 𝘄𝗶𝘁𝗵 𝗪𝗲𝗯 𝗣𝗮𝗴𝗲𝘀 I’ve written a beginner-friendly guide that breaks down: ✔ What the DOM really means ✔ How the browser creates a live page structure ✔ How JavaScript reads and updates elements in real time No heavy jargon — just clear examples and simple explanations. 👉 Read here: https://lnkd.in/gFP3zQpw If you’re learning JavaScript, **keep following me on Dev.to** for more beginner-friendly content on core concepts and fundamentals 🚀 👉 My Dev.to profile: https://lnkd.in/ghYfBtpN #JavaScript #FrontendDevelopment #DOM #WebDev #Coding #Beginners
To view or add a comment, sign in
-
🚀 Day 24 – JavaScript Objects In today’s session, I learned: ✅ Objects in JavaScript 🔹 Objects as key–value pairs 🔹 Real-world example (name, age, city) ✅ Creating Objects 🔹 Using {} with key: value pairs ✅ Identifiers 🔹 Rules for valid identifiers 🔹 Using quotes for invalid keys ✅ Accessing Properties 🔹 Dot notation 🔹 Bracket notation 🔹 Variables as keys ✅ Object Operations 🔹 Modifying existing properties 🔹 Adding new properties ✅ Property Values 🔹 Function as a value 🔹 Array as a value 🔹 Object as a value 💡 Key takeaway: Objects make data structured, flexible, and easy to manage in JavaScript. #JavaScript #FullStackDevelopment #LearningInPublic #Nettms #NettmsEducation @nettmsurbanhabitat @nettmseducation
To view or add a comment, sign in
-
👀 This JavaScript Code Looks Harmless… But the Output Isn’t What You Think Most people read this and say “easy” But many answer it wrong — even experienced devs. let user = { name: "Veera" }; console.log(user.name); console.log(user.age); console.log("age" in user); console.log(user.hasOwnProperty("age")); No arrays. No async. No tricky syntax. Just a simple object 👀 Still… the last two lines confuse many. 🧠 Why this question matters Tests object property access Shows the difference between: value being undefined property not existing Very common interview concept Looks simple but checks real JS understanding 💬 Your Turn Comment your answers like this 👇 Line 1 → ? Line 2 → ? Line 3 → ? Line 4 → ? Try answering without running the code 🤓 I will post the correct output + simple explanation in the evening 📌 Note: This post is to understand JavaScript behavior, not to confuse beginners #JavaScript #FrontendDevelopment #LearnJS #CodingInterview #Objects #TechWithVeera #WebDevelopment #100DaysOfCode
To view or add a comment, sign in
-
-
Converting arrays to strings can be a tricky task, especially for beginners 📝. I recall my early days in JavaScript, struggling to turn object arrays into comma-separated strings. After some research, I discovered a few simple methods to achieve this. By utilizing JavaScript's built-in functions, you can easily convert arrays into strings with or without commas. Read more: https://lnkd.in/gb63R9N8 #JavaScript #ProgrammingTips #WebDevelopment
To view or add a comment, sign in
-
Why & How Functions Are Objects in JavaScript 🤯 One of the most interesting (and confusing) concepts in JavaScript is that 𝗳𝘂𝗻𝗰𝘁𝗶𝗼𝗻𝘀 𝗮𝗿𝗲 𝗼𝗯𝗷𝗲𝗰𝘁𝘀 👉 Why? JavaScript treats functions as 𝗳𝗶𝗿𝘀𝘁-𝗰𝗹𝗮𝘀𝘀 𝗰𝗶𝘁𝗶𝘇𝗲𝗻𝘀 This means functions can: • Be stored in variables • Be passed as arguments • Be returned from other functions To support all this flexibility, JavaScript internally represents a function as a special type of object. 👉 How? When you create a function, JavaScript actually creates an 𝗼𝗯𝗷𝗲𝗰𝘁 𝗶𝗻 𝗺𝗲𝗺𝗼𝗿𝘆 with: • Executable code (the function body) • Properties (like `name` and `length`) • Methods (like `call`, `apply`, `bind`) • A hidden `[[Prototype]]` linking it to `Function.prototype` That’s why this works 👇 function greet() {} greet.language = "JavaScript"; console.log(greet.language); // JavaScript Here, we’re attaching a property to a function — something only objects can do. #JavaScript #WebDevelopment #Frontend #Programming #SoftwareEngineering #Learning
To view or add a comment, sign in
-
-
🧠 JavaScript doesn’t break because of shortcuts. It breaks when fundamentals aren’t fully understood. I once tried using throw new Error() inside a ternary operator, expecting it to behave like a simple if/else. ❌ That didn’t work. 🧠 Why this happens (important detail): • throw is a statement, not an expression • Ternary operators only allow expressions It’s a tiny syntax rule — but a big “aha” moment. 💡 What this reinforced for me: ✔️ Fundamentals matter more than clever tricks ✔️ JavaScript prefers clarity over shortcuts ✔️ Small misunderstandings can lead to long debugging sessions These little details often separate code that runs from code that’s reliable. 👀 Your turn: What’s the smallest JavaScript mistake that once cost you the most time? 💬 Drop it in the comments — let’s learn from each other. #JavaScript #NodeJS #WebDevelopment #SoftwareEngineering #CodingLife #DeveloperLearning #CleanCode #Debugging #ProgrammingTips #TechCommunity #BuildInPublic
To view or add a comment, sign in
-
-
🔥 Hoisting & Temporal Dead Zone: JavaScript's Best-Kept Secret Ever wonder why JavaScript sometimes lets you use variables before declaring them, but other times throws an error? Here's the truth: HOISTING is JavaScript's way of scanning your code first and recognizing all declarations before execution—like reading the table of contents before diving into a book. TEMPORAL DEAD ZONE (TDZ) is the protective barrier that modern JavaScript creates, preventing you from accessing variables before they're properly initialized. The old way? JavaScript was lenient—it let you access variables early (with placeholder values), which often led to confusing bugs. The modern way? JavaScript is strict—try to access a variable in the TDZ, and you get a clear error message. This "strictness" is actually protecting you from hard-to-find bugs! Think of TDZ as JavaScript saying: "I know this variable exists, but you can't touch it yet. Trust me, this is for your own good!" 🛡️ The takeaway? These aren't JavaScript quirks—they're features that make your code more predictable and maintainable. Understanding them transforms you from someone who codes by trial-and-error to someone who codes with confidence. Which JavaScript concept confused you the most when learning? Let's discuss! 💬 #JavaScript #WebDevelopment #CodingTips #Programming #TechEducation #SoftwareEngineering #DeveloperLife #LearnToCode #WebDev #TechCommunity
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