Jacen Lemmy
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
sorrybookbroke@sh.itjust.works to Programmer Humor@lemmy.mlEnglish ·
edit-2
2 years ago

"m=!0"... What the hell am I looking at?

sh.itjust.works

message-square
12
link
fedilink
26

"m=!0"... What the hell am I looking at?

sh.itjust.works

sorrybookbroke@sh.itjust.works to Programmer Humor@lemmy.mlEnglish ·
edit-2
2 years ago
message-square
12
link
fedilink
  • lastunusedusername2@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    61
    ·
    2 years ago

    It looks like it’s just assigning the scope variable m to true (also false in the m=!1 case.

    It’s minified code and m=!0 is fewer characters than m=true.

    • 📛Maven@lemmy.sdf.org
      link
      fedilink
      English
      arrow-up
      11
      arrow-down
      1
      ·
      2 years ago

      Well I hate that. Is there a reason m=1 wouldn’t be the same thing as m=!0?

      • Hack3900@lemdit.com
        link
        fedilink
        English
        arrow-up
        40
        ·
        2 years ago

        Types are dynamic so I think the ! operator converts int to bool in JS

      • Heavybell@lemmy.world
        link
        fedilink
        arrow-up
        30
        ·
        2 years ago

        1 is truthy, but not the exact same thing as true, and the distinction can be important.

      • InvertedParallax@lemm.ee
        link
        fedilink
        arrow-up
        8
        ·
        2 years ago

        1 != true, 1 is an int, true is a boolean

        • master5o1@lemmy.nz
          link
          fedilink
          English
          arrow-up
          1
          ·
          2 years ago

          deleted by creator

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.

  • 19 users / day
  • 19 users / week
  • 19 users / month
  • 2.91K users / 6 months
  • 0 local subscribers
  • 0 subscribers
  • 885 Posts
  • 14.1K Comments
  • Modlog
  • mods:
  • AgreeableLandscape@lemmy.ml
  • cat_programmer@lemmy.ml
  • BE: 0.19.11
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org