
Returning to JavaScript After 5 Years - dictum
https://hackernoon.com/ripvanwinkle-js-returning-to-javascript-after-5-years-1dc17c57a518
======
automatwon
_With just a few lines of JavaScript, engineers can move markets, change
lives, and build the future._

Either this is exaggerated, or people write incomprehensibly dense JavaScript
code.

------
lcw
I feel like if I hadn't written JS in 3 years and was dropped into some JS
code today I wouldn't even be able to read it much less code review it
adequately. There were a series of months relatively recently where every week
I would look at a code review, and be like this is a thing? When did this
happen? That said the changes were not exhausting at all. It was like being
gifted a new tool, and you were just trying to find a new project to use it
on. Now I find myself looking through the TC39 proposals window shopping.

------
ClayFerguson
TypeScript is the modern way to 'do' JavaScript. It solves every problem that
JavaScript ever had.

~~~
automatwon
It does not solve every problem JavaScript ever had. By definition of being a
superset, it's still JavaScript. It just induces a prescription to mitigate
symptoms of type unsafeness.

Null AND Undefined still coexist, though type safety helps. There's an
idiomatic way to specify classes, as opposed to using a pattern of object
returning closure function for instance. There's still both the == and ===
operators.

A problem beyond type-safety is the confusing semantics of 'this':
[https://github.com/Microsoft/TypeScript/wiki/'this'-in-
TypeS...](https://github.com/Microsoft/TypeScript/wiki/'this'-in-TypeScript)

~~~
pluma
The semantics of 'this' in TS are the same as in JS and they're only a problem
if you expect TS to be Java rather than JS.

~~~
ClayFerguson
I use the '=>' operator to get a 'this' reference that does what you'd expect
(like in Java) by getting whatever object is running rather than the typical
JS 'this' of the function. Trivial example is here:

[https://github.com/Clay-
Ferguson/meta64/blob/master/src/main...](https://github.com/Clay-
Ferguson/meta64/blob/master/src/main/resources/public/ts/dlg/ConfirmDlg.ts)

