Pricefield | Lemmy
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
☆ Yσɠƚԋσʂ ☆ to Programmer [email protected]English • 22 hours ago

Which of these javascript expressions is false?

lemmy.ml

message-square
15
fedilink
  • cross-posted to:
  • [email protected]
72

Which of these javascript expressions is false?

lemmy.ml

☆ Yσɠƚԋσʂ ☆ to Programmer [email protected]English • 22 hours ago
message-square
15
fedilink
  • cross-posted to:
  • [email protected]
alert-triangle
You must log in or register to comment.
  • ThotDragon
    link
    fedilink
    English
    6•20 hours ago

    I’m guessing C

    • @[email protected]
      link
      fedilink
      English
      1•7 hours ago

      Just because it’s not a number, doesn’t mean it’s the same not number. But what if it is? 🙃

    • ☆ Yσɠƚԋσʂ ☆OP
      link
      fedilink
      3•19 hours ago

      yup

  • TFed 🍉🌻
    link
    fedilink
    3•16 hours ago

    @yogthos i afraid of (0 == ‘’) :blob_grinning_sweat:

  • @[email protected]
    link
    fedilink
    3•18 hours ago

    A && B && C && D

  • davel [he/him]
    link
    fedilink
    English
    25•21 hours 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
      link
      fedilink
      English
      18•20 hours 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.

      • NewDark [he/him]
        link
        fedilink
        English
        5•13 hours ago

        I love javascript. It’s so insane in such fun ways to prevent itself from throwing errors. It’s got like a naive cute charm to it ya know?

      • mathemachristian [he/him]
        link
        fedilink
        3•13 hours ago

        thats how we often do it in math. The minimum over the empty set is ∞

  • @[email protected]
    link
    fedilink
    3•21 hours ago

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

    • ☆ Yσɠƚԋσʂ ☆OP
      link
      fedilink
      8•21 hours ago

      it’s not B

  • @[email protected]
    link
    fedilink
    English
    1•6 hours ago

    Moot! Those ALL fail code review!

  • ClathrateG [none/use name]
    link
    fedilink
    English
    2•
    edit-2
    13 hours ago

    is D two single quotes, or one double quote?

    • ☆ Yσɠƚԋσʂ ☆OP
      link
      fedilink
      3•9 hours ago

      I’m guessing single quotes, since a single double quote isn’t valid syntax.

      • @[email protected]
        link
        fedilink
        3•7 hours ago

        Yeah, not even JavaScript is that insane!

Programmer [email protected]

[email protected]
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.
  • 24 users / day
  • 93 users / week
  • 164 users / month
  • 1.61K users / 6 months
  • 4 subscribers
  • 1.76K Posts
  • 37.8K Comments
  • Modlog
  • mods:
  • @[email protected]
  • @[email protected]
  • UI: 0.18.4
  • BE: 0.18.2
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org