Logo
Build time: When coffee becomes code.
  • Home
  • Hot
  • Random
  • Search

Browse

  • AI AI
  • AWS AWS
  • Agile Agile
  • Algorithms Algorithms
  • Android Android
  • Apple Apple
  • Azure Azure
  • Backend Backend
  • Bash Bash
  • C++ C++
  • Cloud Cloud
  • 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 314.5K 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

LG 34U530A-W 34-inch UltraWide WFHD (2560 x 1080) IPS Wide Computer Monitor, 100Hz, VESA DisplayHDR 400, HDMI, DisplayPort, USB Type-C, Tilt/Height/Swivel Stand, White

LG 34U530A-W 34-inch UltraWide WFHD (2560 x 1080) IPS Wide Computer Monitor, 100Hz, VESA DisplayHDR 400, HDMI, DisplayPort, USB Type-C, Tilt/Height/Swivel Stand, White

Affiliate
$299.38
GearScouts.com

GearScouts.com

Sponsored
Power stations
Ctrl+C: The Silent Developer Killer

Ctrl+C: The Silent Developer Killer

Linux
399.3K views 9 months ago