Logo
Most expensive bug: $460M rocket explosion.
  • 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

Prototype-chain Memes

Posts tagged with Prototype-chain

It's All There In The Specs, Bro

Javascript Programming Webdev
11 months ago 391.1K views 1 shares
It's All There In The Specs, Bro
So you're telling me that accessing an array with a negative index in JavaScript not only works but actually adds a property to the array? And then when you check the array, it shows you this cursed -1: 4 sitting there like it belongs? The bell curve perfectly captures the JavaScript experience: beginners think it's ridiculous (correct), experts also think it's ridiculous (also correct), but the middle crowd has Stockholm syndrome and will defend it with their lives. "It makes sense bro, everything in JS is an object!" Yeah, and that's exactly the problem. JavaScript treats arrays like objects because they are objects, so test[-1] = 4 is just adding a property named "-1" to your array object. It's technically in the spec, which somehow makes it worse.

Today's picks

Simple Houseware Desk Dual Monitor Stand Riser with Drawer, Rustic Brown | Customizable Organizer Tray, Built-In Phone & Tablet Slot and Side Storage

Simple Houseware Desk Dual Monitor Stand Riser with Drawer, Rustic Brown | Customizable Organizer Tray, Built-In Phone & Tablet Slot and Side Storage

Affiliate
$39.97
Be very quiet

Be very quiet

Java
270.5K views 5 years ago
NordVPN

NordVPN

Sponsored
VPN