Logo
The first webcam monitored a coffee pot.
  • 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.7M 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

Handover

Handover

Programming
172.4M views 2 days ago
Lenovo ThinkPad P14s Gen 6 Copilot+ Mobile Workstation 14.0" IPS WUXGA

Lenovo ThinkPad P14s Gen 6 Copilot+ Mobile Workstation 14.0" IPS WUXGA

Affiliate
$2449.99
NordVPN

NordVPN

Sponsored
VPN