News for hackers. Stuff that matters.
Re:JavaScript for People Who Hate JavaScript by WorldMaker on Wednesday August 09, 2017 @10:38AM (#14969409)
> Some people prefer writing JavaScript without semicolons. How do they not have bugs all over the place ?

The same way that people who write with semicolons avoid lots of bugs: linters and transpilers and tests.

That said there is only one rule to remember when not writing semicolons, the easy to remember "winky frown" rule: all frowns must wink if they start a line/statement. ;( ;[ ;`

;(The last two are quite rare in my experience.)

It's not that tough of a rule to remember.

Re:JavaScript for People Who Hate JavaScript by gknoy on Wednesday August 09, 2017 @06:04PM (#14974148)
Our projects' linting rules specify no semicolons, except when necessary; this means that we will _very rarely_ write something like this when we want to iterate over a small literal array:

    ;['foo', 'bar'].forEach(function (f) {
      it(`has an ${f} field`, function () {
        expect(......)
      })
    }
That said, we tend to use that construct extremely rarely, such as in a few test cases where we are doing the same kinds of things on two groups of items that need different descriptions.
Re:JavaScript for People Who Hate JavaScript by WorldMaker on Thursday August 10, 2017 @11:13AM (#14980492)
Most of my usages are Typescript type assertions:

    ;(thing as Type).methodINeed()
If it weren't for these I mostly wouldn't need semicolons at all, sometimes I refactor to:

    const thingType = thing as Type
    thingType.methodINeed()