Logo
HTTP 451: Unavailable for legal reasons (Fahrenheit 451).
  • 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

Destructuring Memes

Posts tagged with Destructuring

Destructuring Strings

Javascript Programming Frontend Webdev
6 hours ago 4.0M views 0 shares
Destructuring Strings
Someone discovered that strings are iterable in JavaScript and decided to weaponize destructuring syntax for evil. The function takes a string, destructures its first character (because strings are just fancy arrays, apparently), and checks if it exists. Empty string? No first character to destructure, so a stays false from the default parameter. Any actual string? First character exists, so a becomes truthy. It's technically correct, which is the worst kind of correct. This is the JavaScript equivalent of using a flamethrower to light a candle. Sure, it works, but your code reviewers will question every life choice that led them to this moment. Just use str.length === 0 like a normal person who values their employment.

Today's picks

I Have A News For You Boss

I Have A News For You Boss

Programming
9.7M views 1 day ago
Input Type Text

Input Type Text

Backend
41.1K views 2 years ago
GitHub confession [OC]

GitHub confession [OC]

Linux
80.9K views 2 years ago