The Modern JavaScript Tutorial - Part I. The JavaScript Language (Ilya Kantor)(Z-Library)
JavaScript
No description
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
AI guide
【One-Line Pitch】
A clear, example-driven introduction to core JavaScript for beginners, teaching the language fundamentals (variables, types, operators, loops, functions, objects, arrays, strings, numbers) directly in the browser, ideal for anyone starting programming or web development.
【Book Arc】
- **Opening (~0%–10%)**: Starts with the absolute basics—how to embed scripts with `<script>` tags, then moves into variables, naming rules (camelCase, `$` and `_` allowed), and primitive data types with type conversions (String, Number, Boolean).
- **Early (~10%–23%)**: Covers operators (including tricky assignment results), conditional logic with `if..else` and the ternary `?` operator, loops (`while`, `do..while`), and the `switch` statement with strict equality pitfalls. Also introduces code style best practices and a humorous "ninja" anti-patterns section.
- **Early–Middle (~23%–32%)**: Dives into objects—property ordering (integer keys sorted), references and garbage collection (reachability), methods with `this` binding, and object-to-primitive conversion with three "hints" (string, number, default).
- **Middle (~39%–48%)**: Focuses on numbers (rounding with `Math.floor`/`ceil`, base conversion like `toString(36)`) and strings (escape characters, unicode `\uXXXX`, methods like `trim()` and `repeat()`, plus practical tasks like `ucFirst` and `truncate`).
- **Middle–Late (~48%+)**: Explores arrays and iterables—distinguishing arrays from objects (`Array.isArray`), array methods with `thisArg`, and converting iterables/array-likes into real arrays with `Array.from`.
【Key Takeaways】
- **Script embedding is the entry point** (Opening): Use `<script>` tags in HTML; modern attributes like `type` are optional, and Node.js runs scripts via `node my.js`. This sets up the browser as a learning sandbox.
- **Variable naming has strict rules** (Opening): Names allow letters, digits, `$`, `_`, but can't start with a digit; camelCase is conventional, and case matters (`apple` ≠ `AppLE`). This prevents syntax errors early.
- **Type conversion is explicit and implicit** (Opening): `String(value)` converts explicitly, while operators like `+` may concatenate strings; understanding this avoids "dead code" bugs, e.g., `switch` with strict `===` fails on `"3"` vs `3`.
- **Loops and conditionals are flexible** (Early): `while` converts any condition to boolean (e.g., `while(i)` stops at 0), and `do..while` runs body first; single-line bodies can omit curly braces. This builds control-flow fluency.
- **Objects have special ordering and references** (Early–Middle): Integer-like keys sort ascending (e.g., phone codes `1, 41, 44, 49`), while others keep insertion order; deleting references makes objects unreachable for garbage collection.
- **`this` depends on the call context** (Early–Middle): In `user.sayHi()`, `this` is `user`; referencing the outer variable directly is unreliable if the object is reassigned. This is foundational for methods.
- **Numbers and strings have powerful built-ins** (Middle): `Math.floor`/`ceil` round, `toString(36)` converts bases, and strings support escape sequences (`\n`, `\uXXXX`) plus methods like `trim()` and `repeat()`. Practical tasks (e.g., `ucFirst`) reinforce learning.
- **Arrays vs. iterables vs. array-likes** (Middle–Late): `typeof []` is `"object"`, so use `Array.isArray()`; `Array.from()` converts iterables/array-likes into real arrays, enabling array methods like `pop()`. This bridges data structure gaps.
【Reading Tips】
- **Skim the "ninja" code style section** (~23%): It's entertaining but optional; focus on the positive style rules (indents, line length) and skip the anti-patterns unless you enjoy humor.
- **Deep-read the object conversion and `this` chapters** (~32%): These are conceptually tricky; work through the examples with a console to see how hints ("string"/"number"/"default") affect results.
- **Practice the tasks at chapter ends** (e.g., `ucFirst`, `truncate`, `sumInput`): They're importance-rated (3–5) and test real skills; use the sandbox links if available.
- **Watch for strict equality in `switch`** (~13%): The `"3"` vs `3` example is a classic pitfall—test it yourself to internalize why `default` runs.
- **Take away the `Array.from` pattern** (~48%): It's a reusable solution for handling non-array iterables; skim the iterable protocol details if you're a beginner.
【Coverage Limits】
Excerpts cover roughly the first half of Part I (fundamentals through arrays/iterables); later topics like functions in depth, error handling, and advanced object features are not included in this guide.
Excerpt 1
w box (declare a new variable). We can’t reuse the old one. Though it may seem a little odd at first sight, these languages are quite capable of serious deve...
View in text
Excerpt 2
ge!" ); break; case 'Chrome': case 'Firefox': case 'Safari': case 'Opera': alert( 'Okay we support these browsers too' ); break; default: alert( 'We hope tha...
View in text
Excerpt 3
ll cases the shorter syntax is preferred. “this” in methods It’s common that an object method needs to access the information stored in the object to do its...
View in text
Excerpt 4
0 is a valid number, please don’t stop the input on zero. Run the demo To solution A maximal subarray importance: 2 The input is an array of numbers, e.g. ar...
View in text
Excerpt 5
e using a special “wrapper object”: {"": meetup} . In other words, the first (key, value) pair has an empty key, and the value is the target object as a whol...
View in text
Excerpt 6
ess properties of the global object directly, as window.x . Function object, NFE As we already know, a function in JavaScript is a value. Every value in Java...
View in text
Excerpt 7
} let rabbit = { __proto__: animal, eat: function() { super.eat(); } rabbit.eat(); // Error calling super (because there's no [[HomeObject]]) Summary 1. To e...
View in text
Excerpt 8
n’t have time to load the script. As of now, the loadScript function doesn’t provide a way to track the load completion. The script loads and eventually runs...
View in text
Tags
AI categories
JavaScriptProgramming LanguageProgramming
Text Preview (First 20 pages)
Registered users can read the full content for free
Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.
Generating text preview…
Loading comments...
Reply to Comment
Edit Comment