JavaScript quirk that still confuses developers: typeof null === "object" This isn’t a feature. It’s a legacy bug. Understanding the difference between: null (intentional absence) undefined (not assigned) …prevents subtle bugs in production. #javascript #webdevelopment #coding
More Relevant Posts
-
3 Must-Know JavaScript Concepts for Every Developer: • Closures • Promises & Async/Await • Event Loop If you understand these well, your coding level improves significantly. Which one do you find hardest? #JavaScript #FrontendDevelopment #CodingTips
To view or add a comment, sign in
-
Day 1/30 Write a function createCounter. It should accept an initial integer init. It should return an object with three functions. The three functions are: increment() increases the current value by 1 and then returns it. decrement() reduces the current value by 1 and then returns it. reset() sets the current value to init and then returns it. #30DaysOfCode #JavaScript #LeetCode #WebDevelopment #ProgrammingChallenge #CodingLife
To view or add a comment, sign in
-
-
TypeScript is not just "JavaScript with types". The more I use it, the more I feel types are design notes that the compiler can actually check. A bad type usually means one of three things: - I do not understand the data yet - The API contract is weak - I am mixing too many responsibilities in one place Today I refactored a response type from a loose object into a clear union: success response error response validation response The code immediately became easier to read. Good TypeScript is not about writing complex generics everywhere. It is about making impossible states harder to represent. That is the kind of code clients and teams can trust. #TypeScript #JavaScript #CleanCode
To view or add a comment, sign in
-
Still seeing var in 2026? That’s not legacy-that’s risk. Modern JavaScript demands clarity: const by default, let when needed, and zero tolerance for silent bugs. Small choices in syntax create big differences in production code. #JavaScript #WebDevelopment #CodingBestPractices #Developers #TechLearning
To view or add a comment, sign in
-
Hoisting is a behavior in JavaScript where variable and function declarations are conceptually moved to the top of their containing scope (either the global script or a specific function) during the compilation phase, before the code is actually executed. It is important to understand that your code isn't physically moved anywhere. Instead, the JavaScript engine allocates memory for variable and function declarations before it executes the code line-by-line. #javascript #hoisting #frontend #scripting
To view or add a comment, sign in
-
-
A classic JavaScript quirk that often trips developers up: why does typeof null equal "object"? This behavior dates back to the very early days of JavaScript. It's a known inconsistency, not a bug in the sense of broken functionality, but certainly a surprising one. Understanding this nuance is crucial for writing robust JavaScript. Always remember that checking `value === null` is the reliable way to test for a null value, rather than relying on `typeof`. Mastering these JavaScript oddities helps us build more predictable and maintainable code. #JavaScript #Programming #WebDevelopment #DeveloperTips
To view or add a comment, sign in
-
-
JavaScript: Mirror Distance Problem Day 5 👈 Goal: Find the mirror distance of a number — the absolute difference between the number and its reversed form. Approach: Reverse the given number using modulo (%) and division. Subtract the reversed number from the original. Take the absolute value to ensure a positive result. Example: Input: 123 Reversed: 321 Mirror Distance: |123 - 321| = 198 #JavaScript #TypeScript #DSA #CodingInterview #ProblemSolving #FrontendDevelopment #Developers #100DaysOfCode
To view or add a comment, sign in
-
-
If JavaScript runs on one thread… why doesn’t your app freeze during API calls? Most people think: “JavaScript is single-threaded… but somehow works like multithreading.” That’s not entirely true. JavaScript doesn’t do multithreading — it handles concurrency. Here’s the difference: Multithreading (Java): • Multiple threads run at the same time • Tasks execute in parallel • Output is unpredictable and interleaved JavaScript (Event Loop): • One thread only • Long tasks are delegated to the runtime • Results are processed later via the event loop So what’s really happening? JavaScript avoids waiting. Instead of doing everything itself, it: • Delegates slow work (timers, APIs, I/O) • Keeps executing other code • Handles results when they’re ready That’s why it feels like multiple things are happening at once. But in reality: → No parallel execution → No thread switching → Just smart scheduling Understanding this changes how you write async code. Read full blog: https://lnkd.in/gTmPSJqx #javascript #webdevelopment #programming #eventloop #concurrency
To view or add a comment, sign in
-
Debugging JavaScript: A Comprehensive Guide Effective debugging is the difference between a quick fix and hours of frustration. This guide covers essential strategies and tools for identifying and resolving issues in JavaScript environments. #JavaScript #WebDevelopment #Debugging #SoftwareEngineering #TechTips
To view or add a comment, sign in
-
⚠️ `unknown` vs `any` is not just syntax They look similar But they lead to very different code Both can represent values with an unknown shape `any` is useful when you intentionally want to opt out of TypeScript `unknown` is useful when the value is uncertain, but you still want safety That is why `unknown` is usually the better default for external data And why `any` should be used very intentionally Where do you usually draw the line between `any` and `unknown`? #Typescript #React #Frontend #WebDevelopment #Javascript #ProgrammingTips #FrontendDevelopment #Coding #CodingTips
To view or add a comment, sign in
-
More from this author
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