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

  • GreatRam
    link
    fedilink
    3710 hours ago

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

    • @Hotzilla@sopuli.xyz
      link
      fedilink
      14 hours ago

      C# has const string a = “Hello, World”;

      var in js is legacy, and default should be let, but changing that would break everything

    • @masterspace@lemmy.ca
      link
      fedilink
      English
      2610 hours 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.

      • Psaldorn
        link
        fedilink
        79 hours ago

        If there’s only two options you only need one keyword

        • @Hotzilla@sopuli.xyz
          link
          fedilink
          1
          edit-2
          4 hours ago

          True, but var and let are not same in js, so there is three.

          if(true) {

          var a = "dumdum"

          }

          console.log(a)

          Is valid and functioning javascript. With let it is not.

    • @Scoopta@programming.dev
      link
      fedilink
      1510 hours 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.