JavaScript be like: NaN = Not a Number typeof NaN = “number” Make it make sense 😄 Fun part? NaN is technically a numeric value in JavaScript — it represents an invalid number result (like 0/0). 🙃 And it gets better: NaN === NaN → false Only JavaScript can be this confident and confusing at the same time. #JavaScript #JS #DeveloperHumor #WebDevelopment
JavaScript's NaN: A Confusing yet Valid Number
More Relevant Posts
-
🚀 Prototypal Inheritance (JavaScript) JavaScript uses prototypal inheritance, a mechanism where objects inherit properties and methods from other objects. Every object has a prototype, which is another object. When a property is accessed on an object, JavaScript first checks if the object itself has the property. If not, it looks up the prototype chain until the property is found or the end of the chain is reached. This allows for code reuse and creating hierarchies of objects. Understanding prototypes is essential for building complex object-oriented applications in JavaScript. The `__proto__` property (deprecated but still often seen) and the `Object.getPrototypeOf()` method are used to access an object's prototype. #JavaScript #WebDev #Frontend #JS #professional #career #development
To view or add a comment, sign in
-
-
Promises in JavaScript is actually an interesting concept. Promises are one of the most important concepts in modern JavaScript. A Promise is an object that represents a value that will be either available now, later or never. It has three states: pending, fulfilled and rejected. Instead of blocking the program while waiting for something like data or an image to load, a promise allows JavaScript to continue running and then react when the task finishes. We can build a promise by using the Promise constructor, which takes an executor function with two parameters: resolve and reject. Resolve is called when the operation succeeds, and reject is called when something goes wrong. We can also consume promises using the .then() to handle success and catch() to handle errors. Each .then() method returns a new promise which allows us to chain asynchronous steps in sequence. Another powerful concept is PROMISIFYING, this simply means converting old callback-based APIs (like setTimeout or certain browser APIs) into promises so they can fit into modern asynchronous workflows. Understanding how to build, chain and handle promises properly is the foundation we need in mastering asynchronous JavaScript. #JavaScript #WebDevelopment #FrontendDevelopment #TechJourney #Growth
To view or add a comment, sign in
-
-
Behind the Screen – #31 Do you know? JavaScript is #SingleThreaded, but it can still handle multiple tasks at once. How? JavaScript uses something called the #EventLoop. Here’s the idea: 👉 JavaScript runs one task at a time (single thread) 👉 Long tasks (like API calls, timers) are handled outside the main thread 👉 When they are ready, they are added to a queue 👉 The Event Loop picks tasks from the queue one by one So instead of doing everything at once, #JavaScript manages tasks efficiently. That’s why: • Your UI doesn’t freeze during API calls • Timers work in the background • Apps feel responsive 🔥 JavaScript doesn’t do multiple things at the same time — it manages them smartly. #javascript #webdevelopment #frontend #softwareengineering #techfacts
To view or add a comment, sign in
-
🚀✨ What I learned today in JavaScript 💻 Today I practiced something small but powerful in JavaScript: controlling dropdown menus using "e.stopPropagation()". This helps stop events from bubbling up the DOM when you click inside an element 🔁 — very useful when building dropdowns, menus, and interactive UI components. Example 👇 const plusBtn = document.querySelector(".plus"); const plusMenu = document.querySelector(".plus-menu"); plusBtn.addEventListener("click", (e) => { e.stopPropagation(); plusMenu.classList.toggle("hidden"); }); document.addEventListener("click", () => { plusMenu.classList.add("hidden"); }); Simple concept, but very powerful when building clean UI ⚡ 📚 Learning a little every day and improving step by step. But I have one question… 🤔 Some people say they learned JavaScript in 2 months and mastered it. Please how? 😂😂 Someone should teach me that shortcut. #JavaScript #WebDevelopment #CodingJourney #FrontendDeveloper 🚀
To view or add a comment, sign in
-
Using Ternaries instead of if/else statements in JavaScript help making your code short and concise. - It enables inline usage as an Expressions - For simple conditions it will improve Readability, and more Using Ternaries for simple condition will always be the best approach. #javascript #conditionalstatement #statement #js #ternaries
To view or add a comment, sign in
-
-
Many JavaScript developers learn call(), apply(), and bind(). But remembering the difference can still be confusing. Here’s the simplest way to remember them 👇 👉 call() → calls the function immediately (arguments one by one) 👉 apply() → calls the function immediately (arguments as an array) 👉 bind() → returns a new function without calling it Once you understand these, 'this' in JavaScript becomes much easier. I wrote a simple beginner-friendly guide explaining 'this' with clear examples. I’ll share the article in the comments. Which one confused you the most when you first learned JavaScript — call(), apply(), or bind()? #javascript #webdevelopment #frontenddevelopment #reactjs
To view or add a comment, sign in
-
== VS === It looks equal. But JavaScript decides otherwise. == compares values, but first, it silently converts types. That automatic conversion is called type coercion. A string becomes a number. A boolean becomes 0 or 1. Different types can suddenly become “equal.” Now === is strict. No conversion. No assumptions. It compares value and type exactly as they are. "5" === 5 // false Different types. Different result. This is one of the most common JavaScript quirks — and one of the most dangerous in real-world frontend development. Understanding type coercion is essential for writing clean code, avoiding subtle programming bugs, and mastering JavaScript interview concepts. Follow CodeBreakDev for code that looks right… but isn’t. #JavaScript #WebDevelopment #FrontendDev #JSTips #TypeCoercion #CleanCode #CodingMistakes #JavaScriptTips #SoftwareEngineering
To view or add a comment, sign in
-
🚀 Built a small JavaScript project: Guess The Number Game Features: • Random number generation using JavaScript • User input validation • Dynamic feedback (Too high / Too low) • Attempt tracking Tech Stack: HTML • CSS • JavaScript This project helped me practice DOM manipulation and basic game logic. Try it here: https://lnkd.in/gMDTeM8N #webdevelopment #javascript #frontend #learning
To view or add a comment, sign in
-
“Most developers fail in JavaScript… because they ignore Arrays.” ⚠️ When I started learning JavaScript (JS), I thought Array methods were small topics. But during real Website Development and MERN projects, I realized the truth… Without Array methods, writing clean JS code is almost impossible. map() • filter() • reduce() • find() Master Arrays if you want to grow in JavaScript, MERN and Website Development. #lokeshmali #javascript #js #mern #websitedevelopment #array #coding
To view or add a comment, sign in
-
🧠 JavaScript Concept: Hoisting Explained Hoisting is JavaScript's behavior of moving variable and function declarations to the top of their scope before execution. This is why we can sometimes use variables or functions before they are declared. Example: console.log(name); // undefined var name = "Arun"; Why undefined? Because JavaScript internally treats it like this: var name; console.log(name); name = "Arun"; 🔹 Important Points: • "var" is hoisted and initialized with "undefined" • Function declarations are fully hoisted • "let" and "const" are hoisted but stay in the Temporal Dead Zone (TDZ) ⚠️ Accessing "let" or "const" before declaration will throw an error. 📌 Best Practice: Avoid relying on hoisting — always declare variables at the top for better readability. #javascript #frontenddevelopment #reactjs #webdevelopment #coding
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