• Murdo Maclachlan@lemmy.world
    link
    fedilink
    English
    arrow-up
    24
    ·
    edit-2
    2 years ago

    Image Transcription: Meme


    [Four images of toilet roll holders, each with text above them.

    The first shows a toilet roll holder holding a partially-used roll of toilet paper. Its text reads, “Non-zero value”.

    The second shows a holder holding a completely used roll of toilet paper, leaving just the cardboard tube. Its text reads, “0”.

    The third shows a holder with no toilet roll or cardboard tube on it at all. Its text reads, “null”.

    The fourth shows no holder; simply plain wall. Its text reads, “undefined”.]


    I am a human who transcribes posts to improve accessibility on Lemmy. Transcriptions help people who use screen readers or other assistive technology to use the site. For more information, see here.

    • JackbyDev@programming.dev
      link
      fedilink
      English
      arrow-up
      6
      ·
      2 years ago

      Basically JavaScript uses undefined to mean keys that don’t exist. You know how sometimes when you’re wondering about the semantics of “present but null” and “absent”? It’s basically that. Undefined means it isn’t there but things are only null if they’ve been set to null.

      There are probably more nuances but that is the gist.

  • Speiser0@feddit.de
    link
    fedilink
    English
    arrow-up
    2
    ·
    2 years ago

    I see how you censored at “undefined”. Thanks. The actual value could easily kill anyone who sees it.

  • RandomBit@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    1
    ·
    2 years ago

    In C/C++, undefined should be the meme of the little girl smiling while the house burns down behind her.

    • nintendiator@feddit.cl
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 years ago

      In C. In C++, the image is zalgoified, corrupted, cropped, lens flared, color-inverted, and for some reason converted to Targa file format.

  • aidan@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    2 years ago

    No, at least for JS the picture for undefined should actually be for “not defined” which yes is different. Undefined would be an empty holder without the spool holder.

    0 = a 0 value

    null = a value that means no value

    undefined = the variable doesn’t point to a value

    not defined = there is no variable or anything