Logo
Python and Linux: 1991's best inventions.
  • 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
4 months ago 9.8M 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

Software Engineer Programming Computer Developer Coder T-Shirt

Software Engineer Programming Computer Developer Coder T-Shirt

Affiliate
$16.99
An interesting title

An interesting title

Python
316.1K views 2 years ago
Is this it or am I missing something?

Is this it or am I missing something?

Programming
90.6K views 4 years ago