Logo
The first website is still online (info.cern.ch).
  • Home
  • Hot
  • Random
  • Search

Browse

  • AI AI
  • AWS AWS
  • Agile Agile
  • Algorithms Algorithms
  • Android Android
  • Apple Apple
  • Backend Backend
  • Bash Bash
  • C++ C++
  • Cloud Cloud
  • Csharp Csharp
  • All Categories
As an Amazon Associate ProgrammerHumor.io earns from qualifying purchases.

HTTP 418: I'm a teapot

The server identifies as a teapot now and is on a tea break, brb

HTTP 418: I'm a teapot

The server identifies as a teapot now and is on a tea break, brb

Weird-javascript Memes

Posts tagged with Weird-javascript

JavaScript Is Weird

Javascript Programming Frontend Webdev
3 months ago 285.2K views 1 shares
JavaScript Is Weird
So you're telling me that adding the string 'b' to 'a' twice, then adding 'a' twice more, and calling toLowerCase() somehow produces "banana"? Yeah, that tracks. JavaScript's type coercion is basically that friend who always "helps" by making things infinitely more confusing. Here's what's happening: 'b' + 'a' gives you "ba". Then + + converts the next 'a' to NaN (because unary plus on a string that's not a number = NaN). "ba" + NaN = "baNaN". Add another 'a' and you get "baNaNa". Call toLowerCase() and boom—"banana". It's like JavaScript is gaslighting you into thinking this makes sense. The real question is: who discovered this, and what were they doing at 3 AM to stumble upon it?

Today's picks

Keychron V1 75% Wired Mechanical Keyboard, QMK/VIA Programmable, Hot-swappable Red Switches, Compatible with Mac Windows Linux - Carbon Black

Keychron V1 75% Wired Mechanical Keyboard, QMK/VIA Programmable, Hot-swappable Red Switches, Compatible with Mac Windows Linux - Carbon Black

Affiliate
$75.99
GearScouts.com

GearScouts.com

Sponsored
Power stations
Client Requirements

Client Requirements

Linux
170.6K views 4 years ago