480 karma · joined Jun 11, 2011 (15y ago) · 57 submissions
comment 2y ago · link · parent
Let’s assume we create a new version of JavaScript that is not backward compatible and fixes all of its flaws. As a result, we’d encounter the following problems:
• JavaScript engines become bloated: they need to support both the old and the new version. The same is true for tools such as IDEs and build tools.
• Programmers need to know, and be continually conscious of, the differences between the versions.
• We can either migrate all of an existing code base to the new version (which can be a lot of work). Or we can mix versions and refactoring becomes harder because we can’t move code between versions without changing it.
• We somehow have to specify per piece of code – be it a file or code embedded in a web page – what version it is written in. Every conceivable solution has pros and cons. For example, _strict mode_ is a slightly cleaner version of ES5. One of the reasons why it wasn’t as popular as it should have been: it was a hassle to opt in via a directive at the beginning of a file or a function.
More information: https://exploringjs.com/js/book/ch_history.html#backward-com...
comment 2y ago · link · parent
Tips:
• If you like static typing, you’ll want to use TypeScript. It’s more work to set up, but it catches many bugs, especially subtle ones where JavaScript’s semantics are not intuitive.
• I learned a lot about JavaScript (and Node.js) by writing shell scripts in Node.js.
My books on JavaScript, TypeScript and Node.js shell scripting are free to read online and target people who already know how to program: https://exploringjs.com
comment 2y ago · link · parent
You can indeed translate an async function to an equivalent function that uses .then() but it’s a radical change, not syntactic sugar (as I use that term).
comment 2y ago · link · parent
– The whole book is free to read online.
– This chapter gives an overview of what’s new in each ECMAScript version: https://exploringjs.com/js/book/ch_new-javascript-features.h...
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
W.r.t. the “Dr.”: It’s interesting how much reactions differ. In Germany, people tend to think you are smart if you have a title. In the States, people tend to think you’re incapable of functioning in the real world.
I’m still experimenting. The title has worked well for me w.r.t. branding. Sometimes I mention it, sometimes I don’t.
comment 4y ago · link · parent
– Foundations: https://exploringjs.com/impatient-js/ch_async-js.html
– Promises for async programming: https://exploringjs.com/impatient-js/ch_promises.html
– Async functions: https://exploringjs.com/impatient-js/ch_async-functions.html
– Async iteration: https://exploringjs.com/impatient-js/ch_async-iteration.html
comment 4y ago · link · parent
comment 5y ago · link · parent
comment 5y ago · link · parent
Don’t forget that this book is for people who already know JavaScript well. It doesn’t try to explain the basics. This book does, though: https://exploringjs.com/impatient-js/
comment 5y ago · link · parent
– BigInts (arbitrary precision integers) were a recent addition: https://exploringjs.com/impatient-js/ch_bigints.html
– A proposal for `Decimal` (base 10 floating point numbers with arbitrary precision) is currently at stage 1: https://github.com/tc39/proposal-decimal
comment 5y ago · link · parent
Diagrams help me understand how this works. At the following link, you can see the source code of a simple class and a diagram (section 29.2.2) that shows how all involved objects are connected: https://exploringjs.com/impatient-js/ch_proto-chains-classes...
comment 5y ago · link · parent
comment 5y ago · link · parent
comment 5y ago · link · parent
These are work-arounds: https://exploringjs.com/impatient-js/ch_maps.html#missing-ma...
comment 5y ago · link · parent
JavaScript itself was inspired by Self in this case.
comment 6y ago · link · parent
– JavaScript for impatient programmers (covers most of ES1–ES2020, incl. many advanced topics): https://exploringjs.com/impatient-js/
– Deep JavaScript (covers advanced topics): https://exploringjs.com/deep-js/
comment 6y ago · link · parent
comment 6y ago · link · parent
That’s a first look at the syntax. The details are explained here: https://exploringjs.com/impatient-js/ch_variables-assignment...
But I should clarify that “immutable” here means “immutable binding”.
> Only single- and double-quoted strings are introduced at first
I had to start somewhere. Template literals and tagged templates are a more complex topic that benefits from strings already having been introduced.
> Arrow functions are introduced as just another syntax
Arrow functions are introduced in detail here: https://exploringjs.com/impatient-js/ch_callables.html
---
In general, I occasionally have to initially leave out some details so that the book can be read linearly. But those details are then filled in later in the book.
comment 6y ago · link · parent
comment 6y ago · link · parent
The chapters:
– Asynchronous programming in JavaScript: https://exploringjs.com/impatient-js/ch_async-js.html
– Promises for asynchronous programming: https://exploringjs.com/impatient-js/ch_promises.html
– Async functions: https://exploringjs.com/impatient-js/ch_async-functions.html
– Asynchronous iteration: https://exploringjs.com/impatient-js/ch_async-iteration.html