ubergeek77's Lemmy
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
☆ Yσɠƚԋσʂ ☆@lemmy.ml to Programmer Humor@lemmy.mlEnglish · 2 months ago

Which of these javascript expressions is false?

lemmy.ml

external-link
message-square
8
fedilink
65
external-link

Which of these javascript expressions is false?

lemmy.ml

☆ Yσɠƚԋσʂ ☆@lemmy.ml to Programmer Humor@lemmy.mlEnglish · 2 months ago
message-square
8
fedilink
alert-triangle
You must log in or # to comment.
  • davel [he/him]@lemmy.ml
    link
    fedilink
    English
    arrow-up
    27
    ·
    2 months ago

    Definitionally in IEEE floating point, NaN is not equal to anything, including itself. The only real abomination here is B:

    > Math.min()
    Infinity
    > Math.max()
    -Infinity
    > 
    
    • Ephera@lemmy.ml
      link
      fedilink
      English
      arrow-up
      18
      ·
      2 months ago

      I mean, B does make some amount of sense, if you realize that it’s supposed to give you the maximum among the parameters (so you’d normally call it as Math.max(5, 3) === 5).

      Well, and you can call that with zero parameters, because you can spread an array into it, which might have zero length. And then given these conditions, and if you don’t want to throw an error, then -Infinity is kind of the least bad remaining option, as it’s likely to generally work with the rest of your logic.

  • ThotDragon@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    6
    ·
    2 months ago

    I’m guessing C

    • ☆ Yσɠƚԋσʂ ☆@lemmy.mlOP
      link
      fedilink
      arrow-up
      3
      arrow-down
      1
      ·
      2 months ago

      yup

    • CapriciousDay@lemmy.ml
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      1 month ago

      deleted by creator

  • TFed 🍉🌻@infosec.exchange
    link
    fedilink
    arrow-up
    4
    ·
    2 months ago

    deleted by creator

  • lowleveldata@programming.dev
    link
    fedilink
    arrow-up
    3
    ·
    2 months ago

    A && B && C && D

  • twice_hatch@midwest.social
    link
    fedilink
    English
    arrow-up
    3
    ·
    2 months ago

    Moot! Those ALL fail code review!

  • salmoura@lemmy.eco.br
    link
    fedilink
    arrow-up
    2
    ·
    2 months ago

    It can’t be anything other than B, right?

    • ☆ Yσɠƚԋσʂ ☆@lemmy.mlOP
      link
      fedilink
      arrow-up
      6
      arrow-down
      1
      ·
      2 months ago

      it’s not B

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: [email protected]

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.

  • 454 users / day
  • 1.09K users / week
  • 3.26K users / month
  • 9.62K users / 6 months
  • 1 local subscriber
  • 37K subscribers
  • 1.79K Posts
  • 37.8K Comments
  • Modlog
  • mods:
  • AgreeableLandscape@lemmy.ml
  • cat_programmer@lemmy.ml
  • BE: 0.19.7
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org