Lemmy Coupou.fr
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
☆ Yσɠƚԋσʂ ☆@lemmy.ml to Programmer Humor@lemmy.ml · 3 years ago

The New Math

lemmy.ml

external-link
message-square
17
link
fedilink
52
external-link

The New Math

lemmy.ml

☆ Yσɠƚԋσʂ ☆@lemmy.ml to Programmer Humor@lemmy.ml · 3 years ago
message-square
17
link
fedilink
  • Ephera@lemmy.ml
    link
    fedilink
    arrow-up
    13
    ·
    3 years ago

    Oh no, it’s even documented on MDN:

    Screenshot showing code examples where all kinds of numbers are being converted to 4 or to 1.

    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt#using_parseint

    • FuckBigTech347@lemmygrad.ml
      link
      fedilink
      arrow-up
      9
      ·
      3 years ago

      Every time I have to write code in jabbascript I think “can’t be that hard” but then I stumble across some weird behavior like this and I first think “must be a bug somewhere in my code” but no. After some research it always turns out it’s actually a documented “feature(?)”.

      I have no idea why this shitty language is so popular and the web standard.

      • ree@lemmy.ml
        link
        fedilink
        arrow-up
        8
        ·
        3 years ago

        jabbascript

        Should becomes standard

    • enebe@lemmy.ml
      link
      fedilink
      arrow-up
      3
      ·
      3 years ago

      Sweet Flying Spaghetti Monster, that’s horrible. I’m guessing the reason is to keep the truth value equivalent when casting to boolean, but there has to be a more elegant way…

      • Ephera@lemmy.ml
        link
        fedilink
        arrow-up
        3
        ·
        3 years ago

        Might be, but this is also a decent explanation: https://lemmy.ml/post/464637/comment/272066

Programmer Humor@lemmy.ml

programmerhumor@lemmy.ml

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmerhumor@lemmy.ml

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 136 users / day
  • 1.54K users / week
  • 2.98K users / month
  • 9.33K users / 6 months
  • 1 local subscriber
  • 37.2K subscribers
  • 1.96K Posts
  • 39.9K Comments
  • Modlog
  • mods:
  • AgreeableLandscape@lemmy.ml
  • cat_programmer@lemmy.ml
  • BE: 0.19.12
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org