Live data from Hacker News

A Modern JavaScript Tutorial

javascript.info

51–60 of 299 posts

Re: A Modern JavaScript Tutorial

#51

Oh no! It's already out of date! (That's a JS changes too fast joke) But seriously, calling it 'modern' is pointless. It's not adding anything valuable and its just going to become out of date (and thus wrong).

It's not pointless. In the context of JS 'modern' generally means es6+ or node as opposed to es5.

Re: A Modern JavaScript Tutorial

#53

Earlier quoted context omitted.

> The default way promises are used is now async/await. `.then()` should not be introduced as anything more than 'you may find this in older codebases'. No, because you might have to write explicit promises in the browser with async API that are callback based. You need to understand how promises work to use async/await at first place anyway. Just like it's better to understand how prototypal inheritance works in JS…

"Just like it's better to understand how prototypal inheritance works in JS BEFORE even using a single class declaration. " About that, does JS class inheritance now work like classes in java for example? Or is it still just syntactic sugar for the prototype inheritance? By your wording, I assume the later?

[deleted]

Re: A Modern JavaScript Tutorial

#54

Earlier quoted context omitted.

> The default way promises are used is now async/await. `.then()` should not be introduced as anything more than 'you may find this in older codebases'. No, because you might have to write explicit promises in the browser with async API that are callback based. You need to understand how promises work to use async/await at first place anyway. Just like it's better to understand how prototypal inheritance works in JS…

"Just like it's better to understand how prototypal inheritance works in JS BEFORE even using a single class declaration. " About that, does JS class inheritance now work like classes in java for example? Or is it still just syntactic sugar for the prototype inheritance? By your wording, I assume the later?

Well, it's complicated :-)

https://stackoverflow.com/questions/36419713/are-es6-classes...

Re: A Modern JavaScript Tutorial

#55
This site is absolutely awesome and I would suggest this to new comers and experienced folks alike. It covers all things related to javascript, explains the concepts really well in a practical day to day application point of view.

I might be sounding like a promoter for it, but it really added a lot of value for me personally, so just wanted to spread the good word.

Re: A Modern JavaScript Tutorial

#56

Earlier quoted context omitted.

Honestly, it’s fine if documentation goes out of date, otherwise what’s the point of writing anything at all? The onus is on the reader to check the publish date of what they are reading, and to cross reference it with other sources to ensure accuracy.

I'd be careful about relying on "updated" dates too heavily. As a professional technical writer, I've seen that some people bump the "updated" timestamp for any update, no matter how small. At other times it's bumped automatically by the build system. I think the best practice is to only bump the timestamp for substantial updates, or to use an explicit changelog at the bottom of the doc. But that practice isn't stand…

That’s a good point to call out, thanks! There is so much involved in being a “defensive reader” heh

Re: A Modern JavaScript Tutorial

#57

Earlier quoted context omitted.

async/await is excellent syntax when you want things to happen one after another. That's the usual case, and that's what I find myself using 95% of the time. However, when you want a more fine-grained concurrent execution of different asynchronous things, then() still could be very useful.

Can you give an example of more fine grained control with then?

const [result1, result3] = await Promise.all([task1(), task2.then(res => task3(res))])

Re: A Modern JavaScript Tutorial

#58
post #40

Oh no! It's already out of date! (That's a JS changes too fast joke) But seriously, calling it 'modern' is pointless. It's not adding anything valuable and its just going to become out of date (and thus wrong).

Disagree. I've been writing JavaScript for twenty years, and I'm very aware that there's a lot of "new" stuff that I need to brush up on. When I saw it call itself "modern" I instantly assumed that it would be covering the kind of information I need to know.

i think it's great on how it brushed on forms and web api's, but in your case it seems exploringjs.com would be a fit (grouped by ecmascript versions).

OTOH out of scope are server-side JS (NodeJS), transpilers like babel, bundlers like webpack, and of course package managers like npm and yarn

Re: A Modern JavaScript Tutorial

#60

Earlier quoted context omitted.

async/await is excellent syntax when you want things to happen one after another. That's the usual case, and that's what I find myself using 95% of the time. However, when you want a more fine-grained concurrent execution of different asynchronous things, then() still could be very useful.

Can you give an example of more fine grained control with then?

Often times operations are order-independent. Specifying those as sequential `await`-s does not make a lot of sense in those situations. I guess less fine grained control is desirable under such circumstances :-)

There's also other useful utilities such as Promise.all(), Promise.any() and Promise.race().

Post reply on HN