Lädt...


🔧 7 Crazy Things In JavaScript: Love It or Hate It


Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to

JavaScript is the language we all love… and sometimes want to throw our keyboards at. It’s everywhere! From making your buttons dance to breaking your website at 2 AM for reasons no one can explain.

JavaScript is powerful, quirky, and downright weird. Let’s talk about some of the craziest things it does.

1. “NaN” Is a Number?

You read that right. “NaN” stands for “Not a Number,” yet JavaScript classifies it as a number. It’s like someone saying, “I’m not hungry… but let’s go eat.”

console.log(typeof NaN); // "number"

Why, JavaScript? Why?

2. Adding Arrays? Sure, Why Not.

What happens when you add two arrays? You’d think JavaScript would throw an error, right? Nope. It just… joins them into a string.

console.log([1, 2] + [3, 4]); // "1,23,4"

This isn’t addition; this is nonsense. But hey, that’s JavaScript for you.

3. True + True = 2?

Try this in your console:

console.log(true + true); // 2

Yep. Because true is treated as 1 and JavaScript thinks, "Math makes sense here!" It doesn’t, but let’s pretend it does.

4. The Mysterious undefined and null

undefined means something hasn’t been assigned a value. null means it’s empty.
But are they the same? No.

console.log(undefined == null); // true
console.log(undefined === null); // false

Confused? So was I. And so is every new JavaScript developer.

5. The this Problem

Ah, this. The bane of JavaScript learners. In one context, this is an object. In another, it’s undefined. In an arrow function? It’s something else entirely.

const obj = {
  name: "JavaScript",
  regular: function () {
    console.log(this.name);
  },
  arrow: () => {
    console.log(this.name);
  },
};

obj.regular(); // "JavaScript"
obj.arrow();   // 

Every time you think you understand this, JavaScript pulls the rug out from under you.

6. Double Equals Is Lazy

In JavaScript, == doesn’t always care about type. So, it tries to convert things for you. That’s nice... until it isn’t.

console.log(0 == "0"); // true
console.log(0 == []); // true
console.log([] == ""); // true

Do yourself a favor: use === instead. Always.

7. Infinite Is a Number

What’s the biggest number in JavaScript? Infinity. What’s smaller than the smallest? Negative infinity. And yes, you can do math with them.

console.log(Infinity - Infinity); // NaN
console.log(Infinity > 1000000);  // true

JavaScript is just casually flexing that math is relative.

How to Check if a Key Exists in an Object in JavaScript | Tajammal Maqbool

Have you ever been knee-deep in JavaScript code and wondered, How to check if a key exists? In this blog, 4 different methods are explained.

favicon tajammalmaqbool.com

Time Events in JavaScript: A Guide | Tajammal Maqbool

JavaScript is amazing, isn’t it? It makes websites interactive and alive. One of its coolest features is Time Events. Don’t worry if it sounds technical; I’ll break it down.

favicon tajammalmaqbool.com

JavaScript Splice - The Ultimate Array Method | Tajammal Maqbool

Master JavaScript's powerful splice method! Learn how to add, remove, and replace array elements effortlessly. Simplify your code with this ultimate guide.

favicon tajammalmaqbool.com

Why We Love It Anyway

For all its quirks, JavaScript is… amazing. It lets you build entire applications, make websites interactive, and even control robots! It’s a little crazy, but that’s part of its charm.

JavaScript teaches us patience, makes us laugh (and cry), and, in the end, gets the job done. Embrace the weirdness.

...

🔧 7 Crazy Things In JavaScript: Love It or Hate It


📈 48.09 Punkte
🔧 Programmierung

🪟 5 things I love about the Samsung Galaxy Z Fold 4 (and 5 things I hate)


📈 36.54 Punkte
🪟 Windows Tipps

🐧 What are things you love about the Linux kernel and things that you hate about it?


📈 36.54 Punkte
🐧 Linux Tipps

📰 5 Reasons Why I Hate GNU/Linux – Do You Hate (Love) Linux?


📈 33.57 Punkte
🐧 Unix Server

🪟 Windows 11 has a lot to love so far (and a few things to hate)


📈 28.99 Punkte
🪟 Windows Tipps

🐧 Love Microsoft Teams? Love Linux? Then you won't love this


📈 27.91 Punkte
🐧 Linux Tipps

🎥 Crazy money and crazy outcomes - cybersecurity acquisitions in all shapes and sizes - ESW #358


📈 27.52 Punkte
🎥 IT Security Video

🕵️ Low CVE-2015-9430: Crazy bone project Crazy bone


📈 27.52 Punkte
🕵️ Sicherheitslücken

🔧 Five Things Developers Can Use to Go On-Call (And Not Hate Their Life) | Five Things


📈 27.24 Punkte
🔧 Programmierung

🔧 JavaScript Modules: Love 'Em or Hate 'Em?


📈 26.78 Punkte
🔧 Programmierung

📰 Three things I love about Samsung's Galaxy Z Fold 4 (and two things I wish were better)


📈 24.4 Punkte
📰 IT Nachrichten

🐧 The reasons why I hate Windows. It's not as I liked it before, but due to recent events I simply hate that OS.


📈 24.27 Punkte
🐧 Linux Tipps

🔧 Learning Web Development: A Love-Hate Relationship


📈 21.44 Punkte
🔧 Programmierung

🐧 Love/hate ubuntu?


📈 21.44 Punkte
🐧 Linux Tipps

🎥 iPhone 15 Pro Max (almost) 1 Year On: A love/hate relationship 😍👿


📈 21.44 Punkte
🎥 Video | Youtube

🐧 Please help me switch to Linux (a love/hate letter to Windows)


📈 21.44 Punkte
🐧 Linux Tipps

🔧 The Quirky Side of C++: Weird Stuff That Makes Us Love (and Hate) It


📈 21.44 Punkte
🔧 Programmierung

📰 Apple Could Bring Back an iPhone Feature We Love and Kill Off One That We Hate


📈 21.44 Punkte
📰 IT Security Nachrichten

🐧 My Love/Hate Relationship With Linux! (1-Year With Linux A Newbie's Perspective)


📈 21.44 Punkte
🐧 Linux Tipps

🪟 Sea of Thieves' future is bright, but my love/hate relationship continues


📈 21.44 Punkte
🪟 Windows Tipps

🍏 Love it or hate it, this is a great way to store gear [Setups]


📈 21.44 Punkte
🍏 iOS / Mac OS

🐧 "BSD is for people who love Unix, and Linux for people who hate Microsoft."


📈 21.44 Punkte
🐧 Linux Tipps

🪟 You’ll love the new Fortnite Midas Xbox controller, even if you hate Fortnite


📈 21.44 Punkte
🪟 Windows Tipps

🐧 I love KDE and i hate it


📈 21.44 Punkte
🐧 Linux Tipps

🪟 Surface Studio 2+ Review: The revolutionary PC that leaves you divided between love and hate


📈 21.44 Punkte
🪟 Windows Tipps

🔧 The Wonderful, Terrifying World of Asynchronous Programming: A Love-Hate Relationship


📈 21.44 Punkte
🔧 Programmierung

🐧 I hate this machine sometimes, yet I love so much. Now I need to setup the OS, dammit.


📈 21.44 Punkte
🐧 Linux Tipps

🔧 ✨ 1 Thing I Love About TailwindCSS v4 Beta and 1 Thing I Hate ✨


📈 21.44 Punkte
🔧 Programmierung

🐧 What do you Love (or Hate) the most about Mailspring?


📈 21.44 Punkte
🐧 Linux Tipps

🍏 Oura Ring review: love the features changes, hate the new subscription


📈 21.44 Punkte
🍏 iOS / Mac OS

🔧 Kubernetes: The Tool We Love to Hate — And Why I’m Still All In


📈 21.44 Punkte
🔧 Programmierung

📰 Network monitoring tools: Features users love and hate


📈 21.44 Punkte
📰 IT Security Nachrichten

matomo