
Ask HN: Re-learn JavaScript today, where to start? - simonebrunozzi
I knew JavaScript well 10-12 years ago, then I stopped using it.<p>I know that things have evolved in the last decade.<p>I want to learn it again, but I&#x27;m a bit confused by all the variations around it... ES6, Node.js, etc.<p>What&#x27;s the best way to clear up confusion, so that I know where to focus my efforts?
======
lollipop25
> 10-12 years ago

So you've had JS before? The good new is that most of what you know still
works. The bad news is that the landscape is now polluted with a lot of tools,
frameworks and whatnots. Best to avoid the hype if you want to take it
seriously.

ES5 brought a lot to JS without change to the syntax. ES5 focuses more on
added essential native APIs, especially array operations like map, reduce,
filter etc. If you manage that, you'll be able to fend off utility libraries
like underscore and lodash until needed. Kangax's compatibility table should
give you an overview of what was introduced: [http://kangax.github.io/compat-
table/es5/](http://kangax.github.io/compat-table/es5/)

Once you've got a handle of ES5, brace yourself for ES6. ES6 introduces a lot
of foreign constructs as well as syntax changes. If you've been in Python, the
destructuring, rest and spread, and module import syntax will look familiar.
If you've been in Java and C#, there's now the concept of classes (albeit,
it's still prototypal inheritance under the hood).

But for now, ES5 stuff should be enough to cover the basic needs. ES6 is more
of conciseness, convenience and all that. The reason why transpilers exist is
because what you can do in ES6 can essentially be done in ES5 but just taking
the longer route to do it.

~~~
simonebrunozzi
Thanks, very useful answer.

Yes, I had JS, and I had Java and C++ (and Fortran77! I was good. And
Assembly), and some Python and a little Ruby. Most of them are quite rusty at
this point.

Would you suggest to go straight to ES6 then?

Also, what could be the best choice to then being able to write chrome
extensions and perhaps chrome apps?

~~~
lollipop25
> Would you suggest to go straight to ES6 then?

ES6, while it's there, is not a must. It's not like the old syntax will stop
working. Take in only what you need. For instance, native Promises are handy,
arrow functions are concise, but I have yet to find compelling use cases to
write generators, proxies, destructuring and all the other funky stuff.

> what could be the best choice to then being able to write chrome extensions
> and perhaps chrome apps?

If you're writing from v8-based platforms (Node, Chrome), then most of ES6
should be available. [https://kangax.github.io/compat-
table/es6/#chrome49](https://kangax.github.io/compat-table/es6/#chrome49)

------
andrewstuart
Here you go, I wrote a post to answer this question:

"An incredibly brief introduction to JavaScript in 2015 for experienced
developers." [http://fourlightyears.blogspot.com/2015/05/an-incredibly-
bri...](http://fourlightyears.blogspot.com/2015/05/an-incredibly-brief-
introduction-to.html)

And FWIW my choice is ReactJS. Others seem to have gone with AngularJS.

~~~
simonebrunozzi
Great post. Questions:

#1: why is the case? I believe you, it might be awesome to also know why.

#2: great.

#3: is this always true, or does it depend on what you are trying to
accomplish? E.g. is it different in the case of building a chrome extension,
versus writing a web app, versus whatever else?

#5: the debugging aspect is actually what I hated the most about JS back in
the days. Can you elaborate a bit more on this aspect?

#6: I assume it's about Node.js.

One suggestion: I don't need it as I've done my search, but it would be useful
to add an initial paragraph about what is React, Angular, Node, etc.

~~~
andrewstuart
#1 Direct programming JavScript in a browser is dead because you can now use
ES2015 which is a much better language and for Python programmers will feel
quite familiar in some ways. ES2015 is compiled to ES5 by a compiler such as
Babel and works cross browser.

#3 Sorry I know only about writing for node.js electron and web browsers, not
browser extensions.

#5 Well if you want to write any significant amount of JavaScript you'll need
all the help you can get debugging. So it is absolutely worth investing time
in learning as much as you can about the Chrome debugger because it is very
powerful and will save you alot of time and grief. In particular, you should
learn how to blackbox a script (it's easy to do and effectively allows you to
step through only your code and not that of the various libraries that your
code is calling) and you should learn how to set breakpoints and examine the
variables that are in scope at your breakpoint. You should definitely learn
how to examine the stack trace to know where the error originated from.
Debugging is hard but worth the effort to learn. I would start by watching
three of four 30 minute to one hours videos on youtube that teach Chrome
developer tools.

#6 npm allows you to include various libraries in your code and it's not
restricted to node.js - you can include them in your browser apps too.

ReactJS - hard to wrap your hear aruond but worth the effort - it's a
beautiful model for building components that you tie together into web apps.

AngularJS - analagous to ReactJS in that it is a framework for building
applications but takes quite a different approach. I dont know much about it
but it's not my cup of tea. I need simple, and after you've learned the
concepts reactjs is simple, whereas my understanding is that AngularJS is not
simple.

node.js is for building server applications like web servers.

electron is for running web applications as desktop applications.

Finally, absolutely do not do any programming in JavaScript without a first
class IDE.

~~~
lollipop25
> Direct programming JavScript in a browser is dead

Wrong. There will be times where you're not the one who decides the stack. If
you're thrown into a legacy codebase, where's your Babel now? If you're thrown
into a framework like Wordpress, where all you need is bits of jQuery, would
you really need a full-blown transpiler setup?

> npm allows you to include various libraries in your code and it's not
> restricted to node.js - you can include them in your browser apps too.

You missed the part where 1) You're not in control of npm's directory
structure (they're always in node_modules which is always beside the
package.json) and 2) Most setups using npm in the frontend use some form of
build phase, which may not fit on all projects.

> do not do any programming in JavaScript without a first class IDE.

Not really. A sufficiently plugged Sublime Text can do almost the same task.
Just add in Sublime Linter, Sublime Linter ES Lint, HTML Prettify (which also
prettifies JS and CSS), a correctly configured .eslintrc, .editorconfig,
.jsbeautifyrc in the root of the project and we're in business. With that, you
have error reporting and code formatter. That takes care of the trivial stuff.
Everything else, discipline.

~~~
andrewstuart
Yes you're right but in my world I'm in total control.

------
angersock
Learn ES5, and the affordances that HTML5 give to it. Then, learn a bit about
underscore/lodash for functional work, and node.js streams. Learn about
promises.

Later, you can learn more modern stuff (ES2015), but getting that solid
foundation back under your feet will be useful. You will also skip a lot of
mucking around with custom build systems.

