• flying_sheep@lemmy.ml
    link
    fedilink
    arrow-up
    5
    arrow-down
    1
    ·
    4 days ago

    Just use a formatter. It’ll show you that the second one is two statements:

    1. {} (the empty block)
    2. +[] coerce an empty array to a number: new Number(new Array())
    • dejected_warp_core@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      3 days ago

      I totally get that: use the right tools and you’ll be okay. This applies to many technologies in this space.

      With respect, I still take this advice like hearing “look out for rattlesnakes if you’re hiking there.” It might be safer to just hike where there are no rattlesnakes, instead.

      • flying_sheep@lemmy.ml
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        3 days ago

        You’re right, of you have compete freedom, do that. If the place you want or need to go to is most comfortably reachable via rattlesnake road, bring boots.

        In other words, if you don’t think the wasm landscape is mature enough to build a web thing with it, you are stuck with JavaScript, but you don’t have to rawdog it. I haven’t run in a single weird thing like this in years of writing typescript with the help of its type system, ESLint and a formatter.