Live data from Hacker News

A Modern JavaScript Tutorial

javascript.info

211–220 of 299 posts

Re: A Modern JavaScript Tutorial

#211

This is not a tutorial [1]. It's more like a guide [2]. [1]: https://documentation.divio.com/tutorials/ [2]: https://documentation.divio.com/how-to-guides/ Edit: I don't mention this to be nitpicky. I mention it because I wish that we would collectively start standardizing those terms. I think it would be helpful if, whenever we saw "… guide" or "… tutorial" we had a general idea about the structure and purpose of th…

I looked at those links. Here's what I got from them: 1. Tutorials "are lessons that take the reader by the hand through a series of steps." They "are oriented towards learning how." 2. How-to guides "take the reader through steps." 3. "How-to guides are wholly distinct from tutorials." If I found a "community" around a topic, do I then get to decide what words mean? By consensus, of course.

You can see a good breakdown of what they mean by each label in this table:

https://documentation.divio.com/introduction/#the-secret

It's certainly a valuable take, even if you disagree with the claim that all 4 functions are required for good documentation.

Re: A Modern JavaScript Tutorial

#213
post #185

Earlier quoted context omitted.

The fact you ask this question gets at my point I think. For several years I've been writing a large computer algebra system(CAS) that runs on a webpage. Every time the user puts some input into a text box the CAS runs. Depending on the input it may run as many as ~40k lines of code. There are no coherent lines upon which to split the CAS as far as anyone developing it can tell. The CAS must run on the browser both t…

The trick is to not break it up. Adding more lose ends will just make the ball of twine more complicated. What you can break out though is independent code that is the same for many apps, that code can be made into a module and reused across apps. Pure mathematical functions can be turned into a library. But what could probably help keep your sanity for a CAS is to add a test case for every change to make sure the sa…

I totally agree, we do all of these things. It was just a little less clear early on in the project what the best structure for the project was :)

Re: A Modern JavaScript Tutorial

#214

I prefer post-modern javascript, the kind that works universally across all browsers starting with Netscape 2.0

Aside from newer methods the only syntax gotchas in my code are template strings and let/const. That makes the code really quick and simple to convert to an old IE friendly application.

Re: A Modern JavaScript Tutorial

#215
post #152

Earlier quoted context omitted.

>There is one small comment at the top of the chapter, which says ‘Irony detected’. The whole chapter is littered with clearly tongue in cheek remarks.

People will absolutely not get that and take the advice to heart.

I see you've met the entire front end team where I work...

Re: A Modern JavaScript Tutorial

#217
post #81

Earlier quoted context omitted.

Unlike other languages, typescript adds zero runtime overhead, and the APIs that one writes in TS are trivially consumable from JS. Consuming JS from TS is also made as easy as possible, including the option to set types aside entirely for some parts of your code using the "any" type, which means "don't type check this, just trust me that it works". TS really is different from other compile-to-js languages in this re…

It adds in developer overhead and for someone writing in JS that is often what you are trying to minimize.

> It adds in developer overhead and for someone writing in JS that is often what you are trying to minimize.

Typescript compiler supports (some) JS DOC

https://www.typescriptlang.org/docs/handbook/jsdoc-supported...

So you can use the compiler as a static analysis tool without buying into the language itself completely, which I do and just stick type definitions to comments when needed.

Re: A Modern JavaScript Tutorial

#218
post #5

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'.

> 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…

Yes because you can and should promisify old libraries.

Re: A Modern JavaScript Tutorial

#219
post #69

Isn’t step 1 of “modern JavaScript” to install TypeScript? :)

Amazing how many JS devs I meet (or work with) that are against the very idea of Typescript.

I get CoffeeScript vibes from TypeScript, and look at where CoffeScript is now.
Post reply on HN