Logo
Code quality metric: WTFs per minute.
  • 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

Hearing Memes

Posts tagged with Hearing

Validate Huang Bs

Javascript
6 hours ago 23.5K views 0 shares
Validate Huang Bs
Senator asks for a simple yes or no. The witness answers with JavaScript, which is a bold choice for a congressional hearing. The code builds an array of responses: [false, false, true, false, true] . Then it runs .some(r => !!r) . Array.prototype.some returns true as soon as one element passes the callback. The !!r double negation just coerces to boolean, which is redundant here because the values already are booleans. That makes it a little extra, like the whole answer. So even if 3 out of 5 answers are "false", a single "true" makes the whole statement technically true . It's the "I never lied, one of my answers was correct" school of validation. Bonus bug: the code returns facts.some(...) but iterates over facts , not responses . responses is never used. Even the lie has dead code in it.

Today's picks

Poor Jensen

Poor Jensen

Cloud
131.1M views 24 days ago
I got a 20 line error yesterday for a missing semicolon

I got a 20 line error yesterday for a missing semicolon

Debugging
93.7K views 4 years ago
NordVPN

NordVPN

Sponsored
VPN