Made with KolourPaint and screenshots from Kate (with the GitHub theme).

  • GreatRam@lemmy.world
    link
    fedilink
    arrow-up
    41
    arrow-down
    5
    ·
    8 months ago

    You’re encoding more information in the typescript one. You’re saying it’s a string that will get updated.

    • masterspace@lemmy.ca
      link
      fedilink
      English
      arrow-up
      25
      arrow-down
      1
      ·
      8 months ago

      Yeah, it’s explicitly distinct from const a: String which says it won’t change, and var a: String, which means this is legacy code that needs fixing.

        • Lemminary@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          8 months ago

          Ah, but this is JS, so there are three options! And they all function entirely differently. And your assumptions don’t apply, either. :D

    • Scoopta@programming.dev
      link
      fedilink
      arrow-up
      14
      arrow-down
      2
      ·
      8 months ago

      You aren’t though. In most languages that use the latter declaration you would prefix the declaration with final or const or the like to specify it won’t be updated.