3 ms·
I actually like JS syntax. It's pretty bland and, with const/let block scoping + await/async, it's easy to understand. What sucks about JS is its lack of a typ
by smt88 10y ago
I actually like JS syntax. It's pretty bland and, with const/let block scoping + await/async, it's easy to understand.
What sucks about JS is its lack of a type system, type coercion, and lack of a standard library. And those things really, really suck (and lead to terrible code). There's a reason MS, Google, and FB have all moved to static-typed JS (TypeScript, TypeScript, and Flow, respectively).
- inputcoffee 10y agoWell, the syntax has this one issue that I just cannot forgive: multiple exceptions to rules. Like why should a beginner have to figure out when the semi-colon is optional, required, and to be avoided? For anyone who says it is easy and then launches into an explanation, please compare your explanation to that in, say, Java and realize the error of your ways.
- maw 10y agoWhen are semicolons to be avoided in JS? I assume daft styleguides pushed by people desperate to show how smart they are don't count. I agree with your broader point, of course; certainly making them optional hasn't helped matters.
- sli 10y agoI don't know of a single instance where it's advised to omit a semicolon, nor one where a semicolon is strictly required. They are always optional. About all I've seen is Standard's guideline to put a semicolon before your entry point closure: ;(function() { // .. snip })() And even that isn't required, it's just a function of another guideline: "Never start a line with (, [, or `." But still, that is only relevant to Standard, not to Javascript in general. It's completely self-enforced by deciding to use Standard if you want. I can't remember ever needing to put one of those characters at the start of a line outside that particular instance, anyway.
- maw 10y agoI think the reason was to work around too simplistic minifiers and concatenators.
- smt88 10y ago> daft styleguides Daft is correct, but some of them are being pushed by large companies and (frustratingly) seem to be somewhat adopted.