👉 List of all notes for this book. IMPORTANT UPDATE November 18, 2024: I've stopped taking detailed notes from the book and now only highlight and annotate directly in the PDF files/book. With so many books to read, I don't have time to type everything. In the future, if I make notes while reading a book, they'll contain only the most notable points (for me).
Infor & Preface
Chap 1 — What is JS?
What's With That Name?
- Not related with Java at all, not just a script but a programming language.
- "Java" → attract mostlty Java programmers, "Script" → light weight.
- Official name specified by TC39 as "ECMAScript" (ES).
- JS in browsers or Node.js is an implementation of ES2019 standard.
- Hosted by ECMA.
- Don't use "JS6" or "ES8", use "ES20xx" or "JS".
Language Specification
- Who decides a new version of JS? → TC39 (~50-100 members) by votes via 5 stages.
- There is just one JS in the wild (not multiple versions).
- Environments run JS: browsers, servers, robots, lightbulbs,....
- Not all are JS, eg.
alert("Hello, JS!")
or console.log()
← they're just APIs of JS environments.
- There are many "JS-looking" APIs:
fetch()
, getCurrentLocation()
, getUserMedia()
,...
- They follow JS rules but just "guests", not official JS specifications.
- Complain "JS is so inconsistent!" ← it's because the environment hehaviors work, not because of JS itself!
- Developer Tools (Inspect Element in Chrome, for example) are... tools for developers. They're NOT JS environment!
- Something works in Dev Tool, doesn't mean JS compiler will understand it.
Many Faces
- Paradigm-level code categories
- Procedural: organizes codes in a top-down, linear progression. ← eg. C
- Object-oriented (OO/classes): organizes codes into classes. ← eg. Java/C++
- Functional (FP): organizes codes into functions. ← eg. Haskell
- JS is a multi-paradigm language. → "meaning the syntax and capabilities allow a developer to mix and match (and bend and reshape!) concepts from various major paradigms"
Backwards & Forwards