Lemmy.one
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
OsrsNeedsF2P@lemmy.ml to Programmer Humor@lemmy.ml · 2 years ago

Yup, Javascript can go F@#! itself

lemmy.ml

message-square
20
fedilink
41

Yup, Javascript can go F@#! itself

lemmy.ml

OsrsNeedsF2P@lemmy.ml to Programmer Humor@lemmy.ml · 2 years ago
message-square
20
fedilink
  • TwilightKiddy@programming.dev
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    2 years ago

    This one is one of my favourite JS quirks:

    JS quirk

    • LeFrog@discuss.tchncs.de
      link
      fedilink
      arrow-up
      0
      ·
      2 years ago

      Wait wtf is happening there?

      • usernamesAreTricky@lemmy.ml
        link
        fedilink
        arrow-up
        2
        ·
        2 years ago

        parseInt is meant for strings so it converts the number there into a string. Once the numbers get small enough it starts representing it with scientific notation. So 0.0000001 converts into "1e-7" where it then starts to ignore the e-7 part because that’s not a valid int, so it is left with 1

        https://javascript.plainenglish.io/why-parseint-0-0000001-0-8fe1aec15d8b

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.

  • 405 users / day
  • 1.24K users / week
  • 3.17K users / month
  • 9.59K users / 6 months
  • 440 local subscribers
  • 37K subscribers
  • 1.8K Posts
  • 38.3K Comments
  • Modlog
  • mods:
  • AgreeableLandscape@lemmy.ml
  • cat_programmer@lemmy.ml
  • BE: 0.19.7
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org