Live data from Hacker News

Ask HN: How do I learn JavaScript?

news.ycombinator.com

101–110 of 128 posts

Re: Ask HN: How do I learn JavaScript?

#102

> as supported by the most recent version of V8 Why choose V8 as your target, and not a recent standard that multiple modern browsers support?

Because no engine implements the whole recent standard and does everything in a 100% standard-conformant way. Learning an imaginary language seems impractical. I feel more sympathetic to Mozilla than Google but from the practical point of view, again, choosing the Google version for the reference makes more sense as it has more browser market coverage + Node. I've also made a game in vanilla JS recently (using only t…

One advantage of using browsers when you want "modern JavaScript (as supported by the most recent version of V8)" is that the fetch API provides a great opportunity to try out async/await, which is the most new language construct. You'll pick up destructuring assignment and optional chaining in minutes, but async/await will make you a better programmer in other languages too, once you get some practice with it.

If you're dead set against browsers, you'll probably have to use deno since its API is friendlier to async/await than node's is.

Re: Ask HN: How do I learn JavaScript?

#104
I got to know the nuances of the language by working with it for years and having to figure out why various things didn't work at different points, but it doesn't sound like that's your style.

This isn't comprehensive, but it's probably the most helpful deep-dive I've ever seen about some aspect of JavaScript. It's about the Event Loop, which is one of the biggest differences between JS and comparable languages like Python: https://www.youtube.com/watch?v=8aGhZQkoFbQ

Contrary to what you might think, even though the event loop is in some sense "distinct from the language", it isn't simply an API. You can't really have JavaScript without the event loop; it exists in both the browser and in Node, and is the basis for most of the language's advantages.

Re: Ask HN: How do I learn JavaScript?

#105

Earlier quoted context omitted.

OP, this is the best answer to your question. Lots of other answers on this thread are either ignoring the part where you said you wanted to really master the language and recommending introductory JS materials, or, bizarrely, telling you to learn something else instead. I don’t think you can master a language in one go. It’s not how most people’s brains work. I think you do it in stages. Get yourself a good introduc…

Reading the spec will convey many useful details. If you truly want to master them, though, implement the spec and pass the conformance suite. If Fabrice Bellard can do it, in C, with no dependencies, you can do it in whatever language you're already comfortable with, using the standard library. It's simply a matter of sustained effort and focus over time.

This is a good idea, but I'd be selective about it. There's a lot of tedious and uninteresting (IMO) stuff in there, like https://tc39.es/ecma262/#sec-array.prototype.splice or how unicode is handled in the source text.

But looking into the details of how object prototypes and properties really work is essential for getting a good grasp of the language.

Re: Ask HN: How do I learn JavaScript?

#106
A problem with learning JS is the old versus new. The language has evolved enormously. Callbacks vs async, functions and arrow functions, and "this" are a few examples. So learning JS perfectly and completely, is a bit like learning not only English, but old English as well. There is very little (if any) JS that is no longer accepted, but there are many parts that are no longer best practice.

I have found that understanding prehistoric JS provides a good base for making sense of where JS is today.

John Resig's (jquery) writings were very helpful, and this site is an absolute must for me.

https://johnresig.com/apps/learn/

Re: Ask HN: How do I learn JavaScript?

#107

A little side note; You could consider ClojureScript. I've worked with JavaScript many times through the years, and never felt that I got close to becoming an expert no matter what. The language it self is in the way. Browser compatibility, language weirdness (like the =, == or === mess) and there are a lot of standards around. But now a days working with ClojureScript, which settles the language problems, I get to f…

Don’t do this. Zero jobs. Might as well learn Elm

Re: Ask HN: How do I learn JavaScript?

#108
post #84

Earlier quoted context omitted.

Unfortunately, when one is seeking to learn JavaScript, you will encounter all variations of: + Use Typescript (no, it's not the same as JS) + Use ClojureScript + Use Elm + Use Reason + Use ... If you go back about five years, you'll find this pattern also exists, except all the things people were saying to use are dead. Dead like a forgotten Egyptian pharaoh - buried and never to be seen again. Unfortunately, all th…

JavaScript is still alive not because it's worthy of being alive (compared to the four other languages you mentioned), but because it was first and became well entrenched. COBOL is still alive too... ClojureScript and Reason are superior languages, period. They will live long happy lives, too.

Oddly enough, being a superior language isn't the same thing as being a language anyone actually wants to use. There's a reason Python and JS are some of the most popular languages in the world despite "superior languages" existing.

I suspect that most of the ones I name will join the bone pile of the many other "superior languages" or continue to be used at most by a niche few.

Re: Ask HN: How do I learn JavaScript?

#109
post #96
post #93

Earlier quoted context omitted.

I never wrapped my mind around the Promises API, but I have always async/await is much easier to grasp in any language

Maybe because it should have looked like this (personal opinion): waitForPromise() .then(handleResolve) .fail(handleReject) .catch(handleException); But actually looks like this: waitForPromise() .then(handleResolve, handleReject) .catch(handleException);

waitForPromise().catch(foo) is exactly the same thing as waitForPromise().then(undefined, foo). Your first example is essentially the same as:

    waitForPromise()
        .then(handleResolve)
        .catch(handleReject)
        .catch(handleException);
With the exception that if `handleResolve` also throws then that will be picked up by `handleReject`, whereas in `waitForPromise().then(handleResolve, handleReject).catch(handleException)` it won’t.

Re: Ask HN: How do I learn JavaScript?

#110

Earlier quoted context omitted.

Because no engine implements the whole recent standard and does everything in a 100% standard-conformant way. Learning an imaginary language seems impractical. I feel more sympathetic to Mozilla than Google but from the practical point of view, again, choosing the Google version for the reference makes more sense as it has more browser market coverage + Node. I've also made a game in vanilla JS recently (using only t…

One advantage of using browsers when you want "modern JavaScript (as supported by the most recent version of V8)" is that the fetch API provides a great opportunity to try out async/await, which is the most new language construct. You'll pick up destructuring assignment and optional chaining in minutes, but async/await will make you a better programmer in other languages too, once you get some practice with it. If yo…

I'm not set against browsers at all. But I didn't know V8 had any problems with async/await. Tank you for highlighting this.
Post reply on HN