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).
A Modern JavaScript Tutorial
51–60 of 299 posts
Re: A Modern JavaScript Tutorial
#52Re: A Modern JavaScript Tutorial
#53Earlier 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?
Re: A Modern JavaScript Tutorial
#54Earlier 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?
https://stackoverflow.com/questions/36419713/are-es6-classes...
Re: A Modern JavaScript Tutorial
#55I 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
#56Earlier 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…
Re: A Modern JavaScript Tutorial
#57Earlier 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?
Re: A Modern JavaScript Tutorial
#58Oh 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.
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
#59Oh 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).
Re: A Modern JavaScript Tutorial
#60Earlier 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?
There's also other useful utilities such as Promise.all(), Promise.any() and Promise.race().