Some middle-aged guy on the Internet. Seen a lot of it, occasionally regurgitating it, trying to be amusing and informative.

Lurked Digg until v4. Commented on Reddit (same username) until it went full Musk.

Was on kbin.social (dying/dead) and kbin.run (mysteriously vanished). Now here on fedia.io.

Really hoping he hasn’t brought the jinx with him.

Other Adjectives: Neurodivergent; Nerd; Broken; British; Ally; Leftish

  • 0 Posts
  • 3 Comments
Joined 5 months ago
cake
Cake day: August 13th, 2024

help-circle
  • This is actually the correct way to do it in JavaScript, especially if the right hand side is more than 1.

    If JavaScript thinks i contains a string, and let’s say its value is 27, i += 1 will result in i containing 271.

    Subtraction doesn’t have any weird string-versus-number semantics and neither does unary minus, so i -=- 1 guarantees 28 in this case.

    For the increment case, ++ works properly whether JavaScript thinks i is a string or not, but since the joke is to avoid it, here we are.