top 50 comments

sorted by: hot top controversial new old
[–] 95 points 2 years ago (4 children)

You'll find an npm package to help you count up to 2.

(I recently learned - maybe here - that the is-even package has over 170k weekly downloads)

  • source
  • hideshow 8 child comments
  • [–] 82 points 2 years ago (2 children)

    What's even wilder is if you look at the code of that package, all it does is include the is-odd package and then return !is-odd. And the is-odd package isn't much better, it does some basic checks on the input and then returns n % 2 === 1.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 27 points 2 years ago (3 children)

    I thought I was missing something. JS is one of my main languages and I always just write the is-odd function myself since it's like 10 characters. It boggles the mind that is-even has 176k weekly downloads

  • source
  • parent
  • hideshow 4 child comments
  • [–] 19 points 2 years ago (1 child)

    To be fair having a name can make things easier to read. I get that i % 2 == 0 is a common pattern and most programmers will quickly recognize what is happening. But isEven(i) is just that much easier to grok and leaves that brainpower to work on something else.

    But I would never import a package for it. I would just create a local helper for something this trivial.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 10 points 2 years ago (1 child)

    Exactly what I would do if I had to reuse it, especially now since I know that adding a package would actually add 2. It all just seems so...inefficient

  • source
  • parent
  • hideshow 2 child comments
  • load more comments (2 replies)
  • load more comments (1 reply)
  • [–] 68 points 2 years ago
    1. it's easy to make fun of
    2. it makes every other programming language look better in comparison
  • source
  • [–] 63 points 2 years ago
    1. It runs in browsers
    2. If you hate your co-workers, then they will also feel your pain.
  • source
  • [–] 61 points 2 years ago (6 children)
    1. You can call it "Java" to enrage other programmers
    2. You can compare numbers against strings without wasting time converting them
  • source
  • hideshow 7 child comments
  • load more comments (5 replies)
    [–] 60 points 2 years ago
    1. It runs in the browser
    2. Web developers know it already so we might as well
  • source
  • [–] 59 points 2 years ago (5 children)
    1. Job security
    2. its not COBOL
  • source
  • hideshow 5 child comments
  • load more comments (5 replies)
    [–] 59 points 2 years ago* (3 children)
    1. It's not PHP.
    2. I don't know. I didn't think I'd get this far.
  • source
  • hideshow 5 child comments
  • load more comments (1 reply)
    [–] 56 points 2 years ago (1 child)
    1. It has the simplest multi-threaded implementation: no threads!
    2. You can goof off while your build system takes 20 minutes to rebuild a non-compiled language
  • source
  • hideshow 2 child comments
  • [–] 41 points 2 years ago (1 child)

    I am forced to try to get a JS certification.

    I am reaching the end of my rope, and starting to think of maybe putting my neck into one.

    Isaac Newton said that we see far because we stand on the shoulders of giants.

    Javascript is like standing on the shoulders of dwarves with brittle bone disease.

  • source
  • hideshow 1 child comment
  • load more comments (1 reply)
    [–] 41 points 2 years ago* (2 children)

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

  • source
  • hideshow 3 child comments
  • load more comments (1 reply)
    [–] 38 points 2 years ago
    1. Ubiquitous; insane amount of libraries and probably some of the best documentation of any language
    2. JS lambda function syntax is nice
  • source
  • [–] 32 points 2 years ago (2 children)

    It leads to typescript

    You get surprises from npm

  • source
  • hideshow 4 child comments
  • [–] 28 points 2 years ago (10 children)

    I spent way too long today figuring out why my app was doing something that it's NOT supposed to do on weekends.

    I read Luxon's docs (pretty cool lib tbh) again and again, and tried everything I could think of to get isWeekend to return a sane result.

    Turns out I was pulling a somewhat older version of Luxon, where isWeekend didn't exist. In any sane language, I expect I'd get a huge warning about a property that doesn't exist, but alas...

    Typescript helps me keep my sanity, but juuuuust barely.

  • source
  • parent
  • hideshow 11 child comments
  • load more comments (9 replies)
  • [–] 22 points 2 years ago

    await and async

  • source
  • [–] 20 points 2 years ago (1 child)
    1. Is available to be used in website scripting.
    2. Not quite as full of footguns as PHP (although it is close).
  • source
  • hideshow 2 child comments
  • [–] 19 points 2 years ago (2 children)

    It has a cup of coffee as logo

  • source
  • hideshow 3 child comments
  • load more comments (1 reply)
    [–] 17 points 2 years ago (9 children)

    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.

  • source
  • hideshow 9 child comments
  • load more comments (9 replies)
    [–] 16 points 2 years ago (3 children)
    load more comments (3 replies)
    [–] 15 points 2 years ago

    A lot of people are familiar with it and........um....hackers like it being in use?

  • source
  • [–] 14 points 2 years ago

    Write down any NaN advantages of JavaScript

  • source
  • [–] 14 points 2 years ago (6 children)

    God people it's getting old

  • source
  • hideshow 6 child comments
  • load more comments (6 replies)
    [–] 13 points 2 years ago (7 children)
    load more comments (7 replies)
    [–] 13 points 2 years ago (3 children)

    It runs in browsers. It… isn’t poop? I don’t know. I’m all out of ideas.

  • source
  • hideshow 3 child comments
  • load more comments (3 replies)
    [–] 12 points 2 years ago

    We have forced it, quite hamfistedly, to do anything. The organic hell-evolution of web browsers turned them into do-anything sandboxed mini-OS. It meant whatever hellish code you used to write your corporate mandated web app could now become a perfectly bloated standalone application. And the demonic language that would enable it was called Javascript. It does the backend and it does the frontend. You could consider those advantages over other devices, like toasters and those handheld electronic games from the 80s.

  • source
  • [+] 11 points 2 years ago
    [–] 11 points 2 years ago
    1. It at least feels slightly little bit like lisp.
    2. Shit I'm f*ed

    .. ah right, it runs on any browser. Lame

  • source
  • [–] 10 points 2 years ago
    [–] 10 points 2 years ago (1 child)

    You can make minecraft mods

  • source
  • hideshow 2 child comments
  • load more comments
    view more: next ›