• @Tenkard@lemmy.ml
    hexbear
    22
    2 months ago
    1. You can call it "Java" to enrage other programmers
    2. You can compare numbers against strings without wasting time converting them
  • ☆ Yσɠƚԋσʂ ☆@lemmy.ml
    hexbear
    13
    2 months ago

    The part that always gets me is when people choose Js for the backend. Like I get that it's the default thing that works on the frontend, so there's some rationale why you might not want to transpile to it from another language. On the backend though, there are so many far better option, why would you willingly go with Js, especially given that you're now forced to do all your IO async.

  • @Fargeol@lemmy.ml
    hexbear
    11
    edit-2
    2 months ago

    1 - Easiest way to run a script in your browser
    2 - Always finds its way if inputs are bad
    Nan - undefined

    • @inetknght@lemmy.ml
      hexbear
      3
      2 months ago

      It’s also not a scripting language.

      It definitely is a scripting language.

      hello-world.js:

      #!/usr/bin/env node
      
      console.log("Hello world");
      

      Your favorite command line tool:

      chmod +x ./hello-world.js
      ./hello-world.js
      

      You just need to install npm, eg via apt-get install npm.

  • @kevincox@lemmy.ml
    hexbear
    5
    2 months ago
    1. Is available to be used in website scripting.
    2. Not quite as full of footguns as PHP (although it is close).
  • @heavyboots@lemmy.ml
    hexbear
    5
    edit-2
    2 months ago

    Browsers love it!

    Practically anything you write will execute without all that scope and well formed statements nonsense.

    Mind you, number 2 is also its biggest flaw as well, but…

  • @Shape4985@lemmy.ml
    hexbear
    3
    2 months ago

    Damn this is hard. I keep java script disabled by default so its hard to say anything good. I begrudgingly have to whitelist websites i need that cant run without it.

    • @ADTJ@feddit.uk
      hexbear
      1
      2 months ago

      I feel like that's more because you don't want websites you visit running code than because you dislike this particular programming language