{"meta":{"title":"你不知道的 JS · 中文精读与交互式学习","subtitle":"基于 Kyle Simpson《You Don't Know JS》书系的知识地图与独立编写的中文讲义","source":"https://github.com/getify/You-Dont-Know-JS","sourceName":"getify/You-Dont-Know-JS","author":"Kyle Simpson (getify)","license":"CC BY-NC-ND 4.0","notice":"本工具为独立编写的中文学习导读与练习平台，非官方、非商业用途。仅收录书名与章节标题作为索引并链接到官方免费原文；不收录、不转载、不翻译原书正文。全部讲义、示例、题目与速查内容均为原创编写。版权归原作者所有，推荐通过官方渠道购买正版支持作者。","editions":[{"id":"1st","name":"第一版 · You Don't Know JS","years":"2014–2015","branch":"1st-ed","status":"已完结 / 已绝版","note":"O'Reilly 出版，6 本，官方以 Markdown 形式免费公开全文。"},{"id":"2nd","name":"第二版 · You Don't Know JS Yet","years":"2019–2025","branch":"2nd-ed","status":"已完结","note":"GetiPub 自出版；前两本正式出版，两本稳定/粗略草稿，两本已取消。"}],"builtAt":"2026-11-07"},"stats":{"editions":2,"books":12,"chapters":71,"sections":145,"topics":54,"groups":8,"quizzes":76,"glossary":80,"cheat":10,"snippets":20,"demos":68,"challenges":14},"editions":[{"id":"1st","name":"第一版 · You Don't Know JS","years":"2014–2015","branch":"1st-ed","status":"已完结 / 已绝版","note":"O'Reilly 出版，6 本，官方以 Markdown 形式免费公开全文。"},{"id":"2nd","name":"第二版 · You Don't Know JS Yet","years":"2019–2025","branch":"2nd-ed","status":"已完结","note":"GetiPub 自出版；前两本正式出版，两本稳定/粗略草稿，两本已取消。"}],"groups":[{"id":"scope","name":"作用域与闭包","icon":"🔗","desc":"词法作用域、作用域链、提升与 TDZ、闭包、模块与最小暴露原则","count":8},{"id":"thisproto","name":"this · 对象 · 原型","icon":"🧩","desc":"this 绑定四规则、箭头函数、原型委托、属性描述符、class 与行为委托","count":7},{"id":"types","name":"类型与值","icon":"🏷️","desc":"内置类型、值与引用、装箱、数组与稀疏、数字精度、null 与空值合并","count":6},{"id":"coercion","name":"强制转换与相等","icon":"⚖️","desc":"ToPrimitive、== 与 ===、真值假值、显式/隐式转换与边界案例","count":6},{"id":"grammar","name":"语法与运算符","icon":"📐","desc":"语句与表达式、ASI、优先级、参数默认值、解构展开与异常","count":6},{"id":"async","name":"异步与事件循环","icon":"⏱️","desc":"事件循环、微任务、回调、Promise、async/await、生成器与实战模式","count":8},{"id":"es6","name":"ES6+ 与模块化","icon":"✨","desc":"let/const、函数形态、模板与 Symbol、Map/Set、ESM、Proxy/Reflect","count":7},{"id":"engine","name":"引擎 · 性能 · 工程化","icon":"⚙️","desc":"JIT、隐藏类与内联缓存、GC 与泄漏、Worker、基准测试与严格模式","count":6}],"books":[{"id":"up-going","ed":"1st","folder":"up & going","name":"Up & Going","cn":"入门与上路","tone":"入门","status":"published","intro":"整部书系的起点，用最短篇幅交代编程的基本构件与 JavaScript 的语言轮廓，并说明后续五本各自解决什么问题。适合零基础或刚从其他语言转来的读者建立地图。","chapters":[{"t":"Into Programming","cn":"走进编程","d":"从语句、变量、条件、循环到函数，建立程序的最小词汇表。","file":"ch1.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/up%20%26%20going/ch1.md"},{"t":"Into JavaScript","cn":"走进 JavaScript","d":"值与类型、比较、作用域、this、原型与异步的第一轮速览。","file":"ch2.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/up%20%26%20going/ch2.md"},{"t":"Into YDKJS","cn":"走进书系","d":"交代六本书的分工，以及「先接受不完美、再深挖机制」的学习方式。","file":"ch3.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/up%20%26%20going/ch3.md"},{"t":"Appendix A: Thank You's!","cn":"附录 A · 致谢","d":"作者致谢名单。","file":"apA.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/up%20%26%20going/apA.md"}],"branch":"1st-ed","url":"https://github.com/getify/You-Dont-Know-JS/tree/1st-ed/up%20%26%20going"},{"id":"scope-closures","ed":"1st","folder":"scope & closures","name":"Scope & Closures","cn":"作用域与闭包","tone":"核心","status":"published","intro":"书系最经典的一本：把「变量到底在哪里能被找到」拆成编译期词法作用域、函数与块作用域、提升，最后落到闭包这一核心机制。理解它，才能解释大量看似诡异的输出。","chapters":[{"t":"What is Scope?","cn":"作用域是什么","d":"引擎、编译器与作用域的协作，LHS / RHS 查询与异常。","file":"ch1.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/scope%20%26%20closures/ch1.md"},{"t":"Lexical Scope","cn":"词法作用域","d":"作用域由写代码时的位置决定，eval 与 with 如何欺骗词法。","file":"ch2.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/scope%20%26%20closures/ch2.md"},{"t":"Function vs. Block Scope","cn":"函数作用域与块作用域","d":"var 的函数作用域、let / const 的块作用域与块级替代方案。","file":"ch3.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/scope%20%26%20closures/ch3.md"},{"t":"Hoisting","cn":"提升","d":"声明与赋值分离，函数优先，以及重复声明的处理。","file":"ch4.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/scope%20%26%20closures/ch4.md"},{"t":"Scope Closures","cn":"闭包","d":"函数记住并持续访问其词法作用域，模块模式的底层原理。","file":"ch5.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/scope%20%26%20closures/ch5.md"},{"t":"Appendix A: Dynamic Scope","cn":"附录 A · 动态作用域","d":"与词法作用域的对照。","file":"apA.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/scope%20%26%20closures/apA.md"},{"t":"Appendix B: Polyfilling Block Scope","cn":"附录 B · 块作用域补丁","d":"ES6 之前如何用 catch 模拟块作用域。","file":"apB.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/scope%20%26%20closures/apB.md"},{"t":"Appendix C: Lexical-this","cn":"附录 C · 词法 this","d":"箭头函数与 self 模式的对比。","file":"apC.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/scope%20%26%20closures/apC.md"},{"t":"Appendix D: Thank You's!","cn":"附录 D · 致谢","d":"作者致谢名单。","file":"apD.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/scope%20%26%20closures/apD.md"}],"branch":"1st-ed","url":"https://github.com/getify/You-Dont-Know-JS/tree/1st-ed/scope%20%26%20closures"},{"id":"this-prototypes","ed":"1st","folder":"this & object prototypes","name":"this & Object Prototypes","cn":"this 与对象原型","tone":"核心","status":"published","intro":"拆穿「JavaScript 也有类」的错觉：先讲清 this 的四条绑定规则，再说明 [[Prototype]] 委托链，最后给出不靠继承、靠对象关联的设计思路。","chapters":[{"t":"this Or That?","cn":"this 还是那个？","d":"为什么需要 this，以及把 this 理解成「函数自身」的误区。","file":"ch1.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/this%20%26%20object%20prototypes/ch1.md"},{"t":"this All Makes Sense Now!","cn":"this 终于说清了","d":"默认绑定、隐式绑定、显式绑定、new 绑定与优先级。","file":"ch2.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/this%20%26%20object%20prototypes/ch2.md"},{"t":"Objects","cn":"对象","d":"字面量与内置对象、属性描述符、可遍历性与不变性。","file":"ch3.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/this%20%26%20object%20prototypes/ch3.md"},{"t":"Mixing (Up) \"Class\" Objects","cn":"混用「类」对象","d":"混入、显式混入与寄生继承，以及它们的代价。","file":"ch4.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/this%20%26%20object%20prototypes/ch4.md"},{"t":"Prototypes","cn":"原型","d":"[[Prototype]] 链、属性屏蔽、constructor 与原型继承的真相。","file":"ch5.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/this%20%26%20object%20prototypes/ch5.md"},{"t":"Behavior Delegation","cn":"行为委托","d":"用对象关联（OLOO）替代类式继承的设计实践。","file":"ch6.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/this%20%26%20object%20prototypes/ch6.md"},{"t":"Appendix A: ES6 class","cn":"附录 A · ES6 class","d":"class 语法糖背后仍是原型委托。","file":"apA.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/this%20%26%20object%20prototypes/apA.md"},{"t":"Appendix B: Thank You's!","cn":"附录 B · 致谢","d":"作者致谢名单。","file":"apB.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/this%20%26%20object%20prototypes/apB.md"}],"branch":"1st-ed","url":"https://github.com/getify/You-Dont-Know-JS/tree/1st-ed/this%20%26%20object%20prototypes"},{"id":"types-grammar","ed":"1st","folder":"types & grammar","name":"Types & Grammar","cn":"类型与语法","tone":"核心","status":"published","intro":"把「值」和「写法」讲透：七种内置类型、数组与字符串的特殊值、原生构造函数包装、显式与隐式强制转换，以及分号、运算符优先级等语法细节。","chapters":[{"t":"Types","cn":"类型","d":"内置类型、typeof 的例外与「变量没有类型、值才有类型」。","file":"ch1.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/types%20%26%20grammar/ch1.md"},{"t":"Values","cn":"值","d":"数组稀疏、字符串不可变、数字精度、特殊值与值/引用。","file":"ch2.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/types%20%26%20grammar/ch2.md"},{"t":"Natives","cn":"原生函数","d":"包装对象、拆箱与 Symbol.toPrimitive 一类内建钩子。","file":"ch3.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/types%20%26%20grammar/ch3.md"},{"t":"Coercion","cn":"强制转换","d":"抽象操作 ToPrimitive / ToNumber / ToBoolean 与 == 规则。","file":"ch4.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/types%20%26%20grammar/ch4.md"},{"t":"Grammar","cn":"语法","d":"语句与表达式、ASI、错误、函数参数与 try..finally。","file":"ch5.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/types%20%26%20grammar/ch5.md"},{"t":"Appendix A: Mixed Environment JavaScript","cn":"附录 A · 混合环境","d":"非浏览器宿主与全局 DOM 变量的差异。","file":"apA.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/types%20%26%20grammar/apA.md"},{"t":"Appendix B: Thank You's!","cn":"附录 B · 致谢","d":"作者致谢名单。","file":"apB.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/types%20%26%20grammar/apB.md"}],"branch":"1st-ed","url":"https://github.com/getify/You-Dont-Know-JS/tree/1st-ed/types%20%26%20grammar"},{"id":"async-performance","ed":"1st","folder":"async & performance","name":"Async & Performance","cn":"异步与性能","tone":"进阶","status":"published","intro":"从「现在与稍后」的事件循环模型出发，依次解决回调信任问题、Promise 链式流程、生成器同步写法，再用基准测试与 Web Worker 讨论真实性能优化。","chapters":[{"t":"Asynchrony: Now & Later","cn":"异步：现在与稍后","d":"事件循环、任务队列、并发与竞态的基本模型。","file":"ch1.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/async%20%26%20performance/ch1.md"},{"t":"Callbacks","cn":"回调","d":"控制反转、信任缺失与回调地狱不只是嵌套问题。","file":"ch2.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/async%20%26%20performance/ch2.md"},{"t":"Promises","cn":"Promise","d":"决议、thenable、链式调用、错误处理与组合器。","file":"ch3.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/async%20%26%20performance/ch3.md"},{"t":"Generators","cn":"生成器","d":"用可暂停函数写出看似同步的异步流程。","file":"ch4.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/async%20%26%20performance/ch4.md"},{"t":"Program Performance","cn":"程序性能","d":"Web Worker、SIMD、asm.js 之外的并行与拆分思路。","file":"ch5.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/async%20%26%20performance/ch5.md"},{"t":"Benchmarking & Tuning","cn":"基准测试与调优","d":"统计有意义的耗时，识别微基准陷阱与尾调用优化。","file":"ch6.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/async%20%26%20performance/ch6.md"},{"t":"Appendix A: Library: asynquence","cn":"附录 A · asynquence 库","d":"作者自研的异步流程抽象。","file":"apA.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/async%20%26%20performance/apA.md"},{"t":"Appendix B: Advanced Async Patterns","cn":"附录 B · 高级异步模式","d":"并发控制、节流与生成器协程。","file":"apB.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/async%20%26%20performance/apB.md"},{"t":"Appendix C: Thank You's!","cn":"附录 C · 致谢","d":"作者致谢名单。","file":"apC.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/async%20%26%20performance/apC.md"}],"branch":"1st-ed","url":"https://github.com/getify/You-Dont-Know-JS/tree/1st-ed/async%20%26%20performance"},{"id":"es6-beyond","ed":"1st","folder":"es6 & beyond","name":"ES6 & Beyond","cn":"ES6 与未来","tone":"进阶","status":"published","intro":"按主题梳理 ES6 新增能力：语法糖、代码组织、异步流控、集合类型、标准库扩充与元编程，并讨论版本化之后语言如何持续演进。","chapters":[{"t":"ES? Now & Future","cn":"ES？现在与未来","d":"版本演进、转译与垫片，以及向后兼容的取舍。","file":"ch1.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/es6%20%26%20beyond/ch1.md"},{"t":"Syntax","cn":"语法","d":"块作用域、解构、默认参数、展开、箭头函数与模板字符串。","file":"ch2.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/es6%20%26%20beyond/ch2.md"},{"t":"Organization","cn":"组织","d":"迭代器、生成器、模块、类与 Symbol。","file":"ch3.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/es6%20%26%20beyond/ch3.md"},{"t":"Async Flow Control","cn":"异步流程控制","d":"Promise、生成器协程与 async/await 的衔接。","file":"ch4.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/es6%20%26%20beyond/ch4.md"},{"t":"Collections","cn":"集合","d":"TypedArray、Map / Set / WeakMap / WeakSet。","file":"ch5.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/es6%20%26%20beyond/ch5.md"},{"t":"API Additions","cn":"API 扩充","d":"数组、字符串、数字、对象与正则的新方法。","file":"ch6.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/es6%20%26%20beyond/ch6.md"},{"t":"Meta Programming","cn":"元编程","d":"属性名、Reflect、Proxy 与函数元信息。","file":"ch7.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/es6%20%26%20beyond/ch7.md"},{"t":"Beyond ES6","cn":"ES6 之后","d":"异步迭代、装饰器风格提案与语言演进方向。","file":"ch8.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/es6%20%26%20beyond/ch8.md"},{"t":"Appendix A: Thank You's!","cn":"附录 A · 致谢","d":"作者致谢名单。","file":"apA.md","url":"https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/es6%20%26%20beyond/apA.md"}],"branch":"1st-ed","url":"https://github.com/getify/You-Dont-Know-JS/tree/1st-ed/es6%20%26%20beyond"},{"id":"2-get-started","ed":"2nd","folder":"get-started","name":"Get Started","cn":"开始上手","tone":"入门","status":"published","intro":"第二版的第一本，取代旧版《Up & Going》。先厘清「JavaScript 到底是什么语言」，再快速巡览值、变量、函数与比较，最后用三根支柱（作用域与闭包、原型、类型与转换）为后续分册画出地图。","chapters":[{"t":"Chapter 1: What Is JavaScript?","cn":"第 1 章 · JavaScript 是什么","d":"名称与规范、多宿主形态、解释与编译、严格模式。","file":"ch1.md","sections":["About This Book","What's With That Name?","Language Specification","Many Faces","Backwards & Forwards","What's in an Interpretation?","Strictly Speaking","Defined"],"url":"https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/get-started/ch1.md"},{"t":"Chapter 2: Surveying JS","cn":"第 2 章 · 巡览 JS","d":"每个文件都是一个程序；值、变量声明、函数、比较与代码组织。","file":"ch2.md","sections":["Each File is a Program","Values","Declaring and Using Variables","Functions","Comparisons","How We Organize in JS","The Rabbit Hole Deepens"],"url":"https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/get-started/ch2.md"},{"t":"Chapter 3: Digging To The Roots Of JS","cn":"第 3 章 · 深挖根基","d":"迭代、闭包、this、原型，以及追问「为什么」的学习方法。","file":"ch3.md","sections":["Iteration","Closure","this Keyword","Prototypes","Asking \"Why?\""],"url":"https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/get-started/ch3.md"},{"t":"Chapter 4: The Bigger Picture","cn":"第 4 章 · 全局图景","d":"三根支柱的相互关系和推荐阅读顺序。","file":"ch4.md","sections":["Pillar 1: Scope and Closure","Pillar 2: Prototypes","Pillar 3: Types and Coercion","With the Grain","In Order"],"url":"https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/get-started/ch4.md"},{"t":"Appendix A: Exploring Further","cn":"附录 A · 深入探索","d":"值与引用、函数形态、条件比较与原型式类。","file":"apA.md","sections":["Values vs. References","So Many Function Forms","Coercive Conditional Comparison","Prototypal \"Classes\""],"url":"https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/get-started/apA.md"},{"t":"Appendix B: Practice, Practice, Practice!","cn":"附录 B · 动手练习","d":"比较、闭包、原型三组练习与参考解答。","file":"apB.md","sections":["Practicing Comparisons","Practicing Closure","Practicing Prototypes","Suggested Solutions"],"url":"https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/get-started/apB.md"}],"branch":"2nd-ed","url":"https://github.com/getify/You-Dont-Know-JS/tree/2nd-ed/get-started"},{"id":"2-scope-closures","ed":"2nd","folder":"scope-closures","name":"Scope & Closures","cn":"作用域与闭包（第二版）","tone":"核心","status":"published","intro":"第一版同名书的彻底重写：从编译阶段讲词法作用域，用「 marbles / buckets / bubbles 」隐喻解释作用域链，补上 TDZ、块级函数声明、全局作用域差异，最后收束到闭包与模块模式（含 CommonJS 与 ESM）。","chapters":[{"t":"Chapter 1: What's the Scope?","cn":"第 1 章 · 作用域是什么","d":"编译与解释、编译器术语、运行时修改作用域与词法作用域。","file":"ch1.md","sections":["About This Book","Compiled vs. Interpreted","Compiling Code","Compiler Speak","Cheating: Run-Time Scope Modifications","Lexical Scope"],"url":"https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/scope-closures/ch1.md"},{"t":"Chapter 2: Illustrating Lexical Scope","cn":"第 2 章 · 图解词法作用域","d":"用隐喻与嵌套作用域建立可复用的心智模型。","file":"ch2.md","sections":["Marbles, and Buckets, and Bubbles... Oh My!","A Conversation Among Friends","Nested Scope","Continue the Conversation"],"url":"https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/scope-closures/ch2.md"},{"t":"Chapter 3: The Scope Chain","cn":"第 3 章 · 作用域链","d":"查找的概念性、遮蔽、函数名作用域与箭头函数。","file":"ch3.md","sections":["\"Lookup\" Is (Mostly) Conceptual","Shadowing","Function Name Scope","Arrow Functions","Backing Out"],"url":"https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/scope-closures/ch3.md"},{"t":"Chapter 4: Around the Global Scope","cn":"第 4 章 · 全局作用域","d":"为什么需要全局、全局对象在哪、globalThis 与全局感知。","file":"ch4.md","sections":["Why Global Scope?","Where Exactly is this Global Scope?","Global This","Globally Aware"],"url":"https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/scope-closures/ch4.md"},{"t":"Chapter 5: The (Not So) Secret Lifecycle of Variables","cn":"第 5 章 · 变量生命周期","d":"何时可用、提升隐喻、重复声明与 TDZ。","file":"ch5.md","sections":["When Can I Use a Variable?","Hoisting: Yet Another Metaphor","Re-declaration?","Uninitialized Variables (aka, TDZ)","Finally Initialized"],"url":"https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/scope-closures/ch5.md"},{"t":"Chapter 6: Limiting Scope Exposure","cn":"第 6 章 · 最小暴露原则","d":"POLE、函数内隐藏、块级作用域与块中函数声明。","file":"ch6.md","sections":["Least Exposure","Hiding in Plain (Function) Scope","Scoping with Blocks","Function Declarations in Blocks","Blocked Over"],"url":"https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/scope-closures/ch6.md"},{"t":"Chapter 7: Using Closures","cn":"第 7 章 · 使用闭包","d":"看见闭包、生命周期与垃圾回收、闭包的实际用途。","file":"ch7.md","sections":["See the Closure","The Closure Lifecycle and Garbage Collection (GC)","An Alternative Perspective","Why Closure?","Closer to Closure"],"url":"https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/scope-closures/ch7.md"},{"t":"Chapter 8: The Module Pattern","cn":"第 8 章 · 模块模式","d":"封装与最小暴露、经典模块、CommonJS 与 ES Modules。","file":"ch8.md","sections":["Encapsulation and Least Exposure (POLE)","What is a Module?","Node CommonJS Modules","Modern ES Modules (ESM)","Exit Scope"],"url":"https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/scope-closures/ch8.md"},{"t":"Appendix A: Exploring Further","cn":"附录 A · 深入探索","d":"隐式作用域、具名函数、var 之争、TDZ 与同步回调。","file":"apA.md","sections":["Implied Scopes","Anonymous vs. Named Functions","Hoisting: Functions and Variables","The Case for var","What's the Deal with TDZ?","Are Synchronous Callbacks Still Closures?","Classic Module Variations"],"url":"https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/scope-closures/apA.md"},{"t":"Appendix B: Practice","cn":"附录 B · 练习","d":"作用域、闭包与模块的分组练习及解答。","file":"apB.md","sections":["Buckets of Marbles","Closure (PART 1)","Closure (PART 2)","Closure (PART 3)","Modules","Suggested Solutions"],"url":"https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/scope-closures/apB.md"}],"branch":"2nd-ed","url":"https://github.com/getify/You-Dont-Know-JS/tree/2nd-ed/scope-closures"},{"id":"2-objects-classes","ed":"2nd","folder":"objects-classes","name":"Objects & Classes","cn":"对象与类（草稿）","tone":"进阶","status":"draft","intro":"官方标注 draft stable（稳定草稿）。从属性容器讲到属性描述符、[[Prototype]] 链、class 语法与 this，最后回到委托与对象组合。仓库目录中仍留有 TODO 小节，说明内容尚未定稿。","chapters":[{"t":"Chapter 1: Object Foundations","cn":"第 1 章 · 对象基础","d":"对象作为属性容器、定义/访问/赋值/删除属性。","file":"ch1.md","sections":["About This Book","Objects As Containers","Defining Properties","Accessing Properties","Assigning Properties","Deleting Properties","Determining Container Contents","Temporary Containers","Containers Are Collections Of Properties"],"url":"https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/objects-classes/ch1.md"},{"t":"Chapter 2: How Objects Work","cn":"第 2 章 · 对象如何工作","d":"属性描述符、对象子类型、元对象协议与原型链。","file":"ch2.md","sections":["Property Descriptors","Object Sub-Types","Object Characteristics","Extending the MOP","[[Prototype]] Chain","Objects Behavior"],"url":"https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/objects-classes/ch2.md"},{"t":"Chapter 3: Classy Objects","cn":"第 3 章 · 类式对象","d":"何时用 class、实例 this、继承、静态与私有成员。","file":"ch3.md","sections":["When Should I Class-Orient My Code?","Keep It classy","Class Instance this","Class Extension","Static Class Behavior","Private Class Behavior","Class Example"],"url":"https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/objects-classes/ch3.md"},{"t":"Chapter 4: This Works","cn":"第 4 章 · this 详解","d":"this 绑定、箭头函数差异与各种变体。","file":"ch4.md","sections":["This Aware","This Is It!","An Arrow Points Somewhere","Variations","Stay Aware"],"url":"https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/objects-classes/ch4.md"},{"t":"Chapter 5: Delegation","cn":"第 5 章 · 委托","d":"放下类思维，用对等对象组合表达行为复用。","file":"ch5.md","sections":["Preamble","What's A Constructor, Anyway?","Ditching Class Thinking","Delegation Illustrated","Composing Peer Objects","Why This?","Thank You!"],"url":"https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/objects-classes/ch5.md"}],"branch":"2nd-ed","url":"https://github.com/getify/You-Dont-Know-JS/tree/2nd-ed/objects-classes"},{"id":"2-types-grammar","ed":"2nd","folder":"types-grammar","name":"Types & Grammar","cn":"类型与语法（草稿）","tone":"进阶","status":"draft","intro":"官方标注 rough draft（粗略草稿）。按「原始值 → 原始值行为 → 对象值 → 强制转换」重新组织第一版的同名主题，新增 BigInt、Symbol 与 Records/Tuples 提案等内容。","chapters":[{"t":"Chapter 1: Primitive Values","cn":"第 1 章 · 原始值","d":"七种值类型、空值、字符串/数字/BigInt/Symbol。","file":"ch1.md","sections":["Value Types","Empty Values","Boolean Values","String Values","Number Values","BigInteger Values","Symbol Values","Primitives Are Built-In Types"],"url":"https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/types-grammar/ch1.md"},{"t":"Chapter 2: Primitive Behaviors","cn":"第 2 章 · 原始值行为","d":"不可变性、赋值语义、字符串与数字的方法与自动装箱。","file":"ch2.md","sections":["Primitive Immutability","Primitive Assignments","String Behaviors","Number Behaviors","Primitives Are Foundational"],"url":"https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/types-grammar/ch2.md"},{"t":"Chapter 3: Object Values","cn":"第 3 章 · 对象值","d":"普通对象、内建对象、数组、正则、函数与 Records/Tuples 提案。","file":"ch3.md","sections":["Types of Objects","Plain Objects","Fundamental Objects","Other Built-in Objects","Arrays","Regular Expressions","Functions","Proposed: Records/Tuples"],"url":"https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/types-grammar/ch3.md"},{"t":"Chapter 4: Coercing Values","cn":"第 4 章 · 强制转换","d":"显式/隐式、抽象操作、具体转换规则与边界案例。","file":"ch4.md","sections":["Coercion: Explicit vs Implicit","Abstracts","Concrete Coercions","Coercion Corner Cases","Type Awareness"],"url":"https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/types-grammar/ch4.md"}],"branch":"2nd-ed","url":"https://github.com/getify/You-Dont-Know-JS/tree/2nd-ed/types-grammar"},{"id":"2-sync-async","ed":"2nd","folder":"sync-async","name":"Sync & Async","cn":"同步与异步（已取消）","tone":"未出版","status":"canceled","intro":"第二版规划中的异步分册，官方 README 已标注 canceled（取消）。仓库目录只有 TODO 占位章节，没有正式正文；需要系统学习异步建议先读第一版《Async & Performance》，并配合本工具「异步与事件循环」知识组。","chapters":[],"branch":"2nd-ed","url":"https://github.com/getify/You-Dont-Know-JS/tree/2nd-ed/sync-async"},{"id":"2-es-next-beyond","ed":"2nd","folder":"es-next-beyond","name":"ES.Next & Beyond","cn":"ES.Next 与未来（已取消）","tone":"未出版","status":"canceled","intro":"第二版规划中的语言演进分册，官方 README 已标注 canceled（取消），仓库目录仅为 TODO 占位。ES6 之后的新语法与提案可参考第一版《ES6 & Beyond》及本工具「ES6+ 与模块化」知识组。","chapters":[],"branch":"2nd-ed","url":"https://github.com/getify/You-Dont-Know-JS/tree/2nd-ed/es-next-beyond"}],"topics":[{"id":"lexical-scope","group":"scope","title":"词法作用域","en":"Lexical Scope","level":"核心","summary":"作用域由「写代码时把变量放在哪」决定，而不是由「函数在哪里被调用」决定。","tags":"词法作用域 静态作用域 编译 引擎 eval with","demo":"scope-chain","refs":[{"b":"scope-closures","c":"Lexical Scope"},{"b":"2-scope-closures","c":"Chapter 1"}],"file":"concepts/scope.json"},{"id":"scope-chain","group":"scope","title":"作用域链与遮蔽","en":"Scope Chain & Shadowing","level":"核心","summary":"查找标识符时由内向外逐层冒泡，找到即停；内层同名变量会「遮蔽」外层。","tags":"作用域链 遮蔽 LHS RHS ReferenceError globalThis","demo":"shadowing","refs":[{"b":"scope-closures","c":"What is Scope?"},{"b":"2-scope-closures","c":"Chapter 3"}],"file":"concepts/scope.json"},{"id":"hoisting-tdz","group":"scope","title":"提升与暂时性死区","en":"Hoisting & TDZ","level":"核心","summary":"var 声明提升并初始化为 undefined；let/const 也登记，但初始化前访问会抛错。","tags":"提升 hoisting TDZ 暂时性死区 var let const typeof 循环闭包","demo":"tdz-loop","refs":[{"b":"scope-closures","c":"Hoisting"},{"b":"2-scope-closures","c":"Chapter 5"}],"file":"concepts/scope.json"},{"id":"block-scope","group":"scope","title":"函数作用域与块作用域","en":"Function vs Block Scope","level":"核心","summary":"var 属于整个函数；let/const 属于最近的 {}；块作用域是最少暴露原则的主力工具。","tags":"块作用域 函数作用域 POLE 最小暴露 let catch IIFE","demo":"block-scope","refs":[{"b":"scope-closures","c":"Function vs. Block Scope"},{"b":"2-scope-closures","c":"Chapter 6"}],"file":"concepts/scope.json"},{"id":"closure","group":"scope","title":"闭包","en":"Closure","level":"核心","summary":"函数连同它出生时的词法环境一起被保留，即使外层已执行完毕仍可访问那些变量。","tags":"闭包 closure 私有变量 计数器 函数工厂 回调 内存","demo":"closure-counter","refs":[{"b":"scope-closures","c":"Scope Closures"},{"b":"2-scope-closures","c":"Chapter 7"}],"file":"concepts/scope.json"},{"id":"module-pattern","group":"scope","title":"模块模式与 ESM","en":"Module Pattern & ESM","level":"进阶","summary":"用闭包 + 最小暴露构造公开 API，是现代 ES Modules 之前最主流的封装手段。","tags":"模块 模块模式 IIFE CommonJS ESM live binding 封装 单例","demo":"module-pattern","refs":[{"b":"scope-closures","c":"Scope Closures"},{"b":"2-scope-closures","c":"Chapter 8"}],"file":"concepts/scope.json"},{"id":"iife-pole","group":"scope","title":"IIFE 与最小暴露原则","en":"IIFE & POLE","level":"进阶","summary":"立即执行函数曾用于造作用域；今天更推荐裸块 + let/const，但读老代码仍必备。","tags":"IIFE 立即执行函数 POLE 最小暴露 ASI 分号 模块","demo":"iife","refs":[{"b":"2-scope-closures","c":"Chapter 6"},{"b":"scope-closures","c":"Function vs. Block Scope"}],"file":"concepts/scope.json"},{"id":"var-lifecycle","group":"scope","title":"变量生命周期与声明选择","en":"Variable Lifecycle","level":"进阶","summary":"从登记、初始化到赋值三个阶段，解释 var / let / const / function 各自的行为差异。","tags":"变量生命周期 var let const 声明 初始化 全局对象 window","demo":"const-binding","refs":[{"b":"2-scope-closures","c":"Chapter 5"},{"b":"2-get-started","c":"Chapter 2"}],"file":"concepts/scope.json"},{"id":"this-binding","group":"thisproto","title":"this 的四条绑定规则","en":"this Binding Rules","level":"核心","summary":"this 不是函数自身，也不是词法作用域；它由调用方式在运行期决定。","tags":"this 绑定 new call apply bind 隐式丢失 严格模式","demo":"this-rules","refs":[{"b":"this-prototypes","c":"this All Makes Sense Now!"},{"b":"2-objects-classes","c":"Chapter 4"}],"file":"concepts/thisproto.json"},{"id":"arrow-this","group":"thisproto","title":"箭头函数与词法 this","en":"Arrow Functions & this","level":"核心","summary":"箭头函数没有自己的 this，它像普通变量一样沿作用域链向外找。","tags":"箭头函数 词法this self arguments new.target 回调","demo":"arrow-this","refs":[{"b":"scope-closures","c":"Appendix C: Lexical-this"},{"b":"2-scope-closures","c":"Chapter 3"}],"file":"concepts/thisproto.json"},{"id":"binding-exceptions","group":"thisproto","title":"绑定例外与常见陷阱","en":"Binding Exceptions","level":"进阶","summary":"忽略传入的 null、间接引用、被 currying 的 bind 参数，以及软绑定的思路。","tags":"bind 软绑定 call null 间接引用 柯里化 new 严格模式","demo":"bind-exceptions","refs":[{"b":"this-prototypes","c":"Chapter 2"},{"b":"2-objects-classes","c":"Chapter 3"}],"file":"concepts/thisproto.json"},{"id":"prototype-chain","group":"thisproto","title":"[[Prototype]] 原型链","en":"Prototype Chain","level":"核心","summary":"对象之间靠内部链接委托属性访问；找不到就沿链向上，直到 Object.prototype。","tags":"原型链 [[Prototype]] Object.create new prototype 委托 属性屏蔽","demo":"prototype-chain","refs":[{"b":"this-prototypes","c":"Prototypes"},{"b":"2-objects-classes","c":"Chapter 2"}],"file":"concepts/thisproto.json"},{"id":"property-descriptor","group":"thisproto","title":"属性描述符与对象不变性","en":"Property Descriptors","level":"进阶","summary":"writable / enumerable / configurable 决定属性能不能改、能不能遍历、能不能删。","tags":"属性描述符 defineProperty writable enumerable configurable freeze seal getter setter","demo":"descriptor","refs":[{"b":"this-prototypes","c":"Objects"},{"b":"2-objects-classes","c":"Chapter 1"}],"file":"concepts/thisproto.json"},{"id":"class-syntax","group":"thisproto","title":"class 语法与原型","en":"class Syntax","level":"进阶","summary":"class 基本是原型委托的语法外壳，加上静态成员、私有字段与继承检查。","tags":"class extends super static 私有字段 # 语法糖 原型继承","demo":"class-basics","refs":[{"b":"this-prototypes","c":"Appendix A: ES6 class"},{"b":"2-objects-classes","c":"Chapter 3"}],"file":"concepts/thisproto.json"},{"id":"delegation","group":"thisproto","title":"行为委托与对象关联","en":"Behavior Delegation / OLOO","level":"进阶","summary":"不复刻「父子」层级，让平级对象互相委托，用组合代替继承树。","tags":"行为委托 OLOO 对象关联 组合 继承 Object.create","demo":"delegation","refs":[{"b":"this-prototypes","c":"Behavior Delegation"},{"b":"2-objects-classes","c":"Chapter 5"}],"file":"concepts/thisproto.json"},{"id":"typeof-types","group":"types","title":"七种原始类型与 typeof","en":"Built-in Types & typeof","level":"核心","summary":"变量没有类型，值才有；typeof 有 null 与 function 两个著名例外。","tags":"typeof null 原始类型 装箱 bigint symbol undefined","demo":"typeof","refs":[{"b":"types-grammar","c":"Types"},{"b":"2-types-grammar","c":"Chapter 1"}],"file":"concepts/types.json"},{"id":"value-reference","group":"types","title":"值与引用","en":"Values vs References","level":"核心","summary":"原始值按值持有，对象按引用持有；赋值与传参都复制「值本身」。","tags":"值 引用 按值传递 浅拷贝 深拷贝 structuredClone 展开运算符","demo":"value-ref","refs":[{"b":"2-get-started","c":"Appendix A"},{"b":"types-grammar","c":"Values"}],"file":"concepts/types.json"},{"id":"primitive-immutable","group":"types","title":"原始值不可变与自动装箱","en":"Immutability & Boxing","level":"进阶","summary":"字符串方法永远返回新值；能调用方法是因为引擎临时创建了包装对象。","tags":"不可变 装箱 拆箱 valueOf toString ToPrimitive Symbol.toPrimitive","demo":"boxing","refs":[{"b":"2-types-grammar","c":"Chapter 2"},{"b":"types-grammar","c":"Natives"}],"file":"concepts/types.json"},{"id":"arrays-strings","group":"types","title":"数组、字符串与稀疏","en":"Arrays, Strings & Sparseness","level":"进阶","summary":"数组是特殊对象，字符串像字符数组但不是；稀疏空洞与 length 行为值得单独记。","tags":"数组 稀疏 空洞 length 类数组 Array.from 字符串 UTF-16 代理对 emoji","demo":"sparse","refs":[{"b":"types-grammar","c":"Values"},{"b":"2-types-grammar","c":"Chapter 3"}],"file":"concepts/types.json"},{"id":"numbers-precision","group":"types","title":"数字、精度与 BigInt","en":"Numbers & BigInt","level":"进阶","summary":"所有 number 都是 IEEE-754 双精度浮点；超过安全整数用 BigInt 或十进制库。","tags":"IEEE754 浮点精度 MAX_SAFE_INTEGER NaN Object.is BigInt -0","demo":"numbers","refs":[{"b":"types-grammar","c":"Values"},{"b":"2-types-grammar","c":"Chapter 1"}],"file":"concepts/types.json"},{"id":"nullish","group":"types","title":"null、undefined 与空值合并","en":"null / undefined / Nullish","level":"核心","summary":"两者语义不同；?? 与 ?. 让「只在真正空值时兜底」变得安全。","tags":"null undefined void 0 空值合并 ?? 可选链 ?. || 假值","demo":"nullish","refs":[{"b":"types-grammar","c":"Types"},{"b":"2-get-started","c":"Chapter 2"}],"file":"concepts/types.json"},{"id":"toprimitive","group":"coercion","title":"ToPrimitive 抽象操作","en":"ToPrimitive","level":"核心","summary":"对象参与运算前会按 hint 依次调用 Symbol.toPrimitive、valueOf、toString。","tags":"ToPrimitive valueOf toString Symbol.toPrimitive hint Date 抽象操作","demo":"toprimitive","refs":[{"b":"types-grammar","c":"Coercion"},{"b":"2-types-grammar","c":"Chapter 4"}],"file":"concepts/coercion.json"},{"id":"equality","group":"coercion","title":"== 与 === 的完整规则","en":"Loose vs Strict Equality","level":"核心","summary":"=== 先比类型；== 在类型不同时按固定规则转换，不是「随便转」。","tags":"== === 宽松相等 严格相等 Object.is null undefined 强制转换","demo":"equality","refs":[{"b":"types-grammar","c":"Coercion"},{"b":"2-types-grammar","c":"Chapter 4"}],"file":"concepts/coercion.json"},{"id":"truthy-falsy","group":"coercion","title":"真值与假值","en":"Truthy & Falsy","level":"核心","summary":"只有 8 个假值；其余所有值（包括 []、{}、\"0\"）都是真值。","tags":"真值 假值 ToBoolean && || 空数组 空字符串 NaN","demo":"truthy","refs":[{"b":"types-grammar","c":"Coercion"},{"b":"2-get-started","c":"Chapter 2"}],"file":"concepts/coercion.json"},{"id":"explicit-coercion","group":"coercion","title":"显式转换与可读写法","en":"Explicit Coercion","level":"进阶","summary":"把转换写清楚：Number / String / Boolean、一元 +、parse 系列各有用处。","tags":"显式转换 Number String Boolean parseInt radix 一元加 Date.now","demo":"explicit","refs":[{"b":"types-grammar","c":"Coercion"},{"b":"2-types-grammar","c":"Chapter 4"}],"file":"concepts/coercion.json"},{"id":"implicit-pitfalls","group":"coercion","title":"隐式转换的经典陷阱","en":"Implicit Coercion Pitfalls","level":"进阶","summary":"+、关系比较、逻辑运算符各自有一套转换规则，混用时最容易出错。","tags":"隐式转换 加法 字符串拼接 关系比较 字典序 Symbol 逻辑运算符","demo":"implicit","refs":[{"b":"types-grammar","c":"Coercion"},{"b":"2-get-started","c":"Appendix A"}],"file":"concepts/coercion.json"},{"id":"coercive-corner","group":"coercion","title":"强制转换速查与边界案例","en":"Coercion Corner Cases","level":"进阶","summary":"把常见值在各转换目标下的结果列成表，配合速查手册使用。","tags":"转换表 边界案例 Number String Boolean 速查","demo":"coerce-table","refs":[{"b":"2-types-grammar","c":"Chapter 4"},{"b":"types-grammar","c":"Values"}],"file":"concepts/coercion.json"},{"id":"statements-expressions","group":"grammar","title":"语句与表达式","en":"Statements & Expressions","level":"核心","summary":"表达式产生值，语句执行动作；理解这点才能解释对象字面量、赋值链与逗号运算符。","tags":"语句 表达式 对象字面量 标签 赋值表达式 完成值","demo":"expr-stmt","refs":[{"b":"types-grammar","c":"Grammar"},{"b":"2-get-started","c":"Chapter 2"}],"file":"concepts/grammar.json"},{"id":"asi","group":"grammar","title":"自动分号插入 ASI","en":"Automatic Semicolon Insertion","level":"进阶","summary":"解析器会在换行处尝试补分号，但只在「不补就会语法错误」时补。","tags":"ASI 自动分号 return 换行 IIFE 无分号风格","demo":"asi","refs":[{"b":"types-grammar","c":"Grammar"}],"file":"concepts/grammar.json"},{"id":"operator-precedence","group":"grammar","title":"运算符优先级与结合性","en":"Precedence & Associativity","level":"进阶","summary":"&& 高于 ||、?? 不能与它们裸混、逗号最低；不确定就加括号。","tags":"优先级 结合性 && || ?? ** 逗号运算符 逻辑赋值","demo":"precedence","refs":[{"b":"types-grammar","c":"Grammar"},{"b":"2-get-started","c":"Chapter 2"}],"file":"concepts/grammar.json"},{"id":"function-params","group":"grammar","title":"参数、默认值与 arguments","en":"Parameters & Arguments","level":"核心","summary":"默认参数有自己的作用域；剩余参数取代 arguments；箭头函数没有 arguments。","tags":"参数 默认参数 剩余参数 arguments TDZ 解构参数","demo":"params","refs":[{"b":"es6-beyond","c":"Syntax"},{"b":"types-grammar","c":"Grammar"}],"file":"concepts/grammar.json"},{"id":"destructuring-spread","group":"grammar","title":"解构与展开","en":"Destructuring & Spread","level":"核心","summary":"解构用于取值，展开用于铺开；两者都只处理一层（浅）。","tags":"解构 展开 spread rest 浅拷贝 Object.assign 默认值","demo":"destructure","refs":[{"b":"es6-beyond","c":"Syntax"},{"b":"2-get-started","c":"Chapter 2"}],"file":"concepts/grammar.json"},{"id":"errors-finally","group":"grammar","title":"异常处理与 try..finally","en":"Errors & try..finally","level":"进阶","summary":"finally 一定会执行，甚至可以覆盖 return；异步错误要靠 Promise 链或 try/catch 捕获。","tags":"try catch finally throw 异步错误 unhandledrejection 自定义Error","demo":"finally","refs":[{"b":"types-grammar","c":"Grammar"},{"b":"async-performance","c":"Callbacks"}],"file":"concepts/grammar.json"},{"id":"event-loop","group":"async","title":"事件循环与「现在 / 稍后」","en":"Event Loop","level":"核心","summary":"同步代码跑完才轮到队列；setTimeout(0) 不是立刻执行，而是下一轮。","tags":"事件循环 调用栈 任务队列 setTimeout 并发 竞态 tick","demo":"event-loop","refs":[{"b":"async-performance","c":"Asynchrony: Now & Later"}],"file":"concepts/async.json"},{"id":"microtasks","group":"async","title":"宏任务、微任务与执行顺序","en":"Macrotasks & Microtasks","level":"核心","summary":"每个宏任务结束后会清空整个微任务队列；Promise 回调属于微任务。","tags":"宏任务 微任务 queueMicrotask Promise await 执行顺序 饥饿","demo":"microtasks","refs":[{"b":"async-performance","c":"Chapter 1"},{"b":"2-sync-async","c":"概念补充"}],"file":"concepts/async.json"},{"id":"callbacks","group":"async","title":"回调与控制反转","en":"Callbacks & Inversion of Control","level":"核心","summary":"回调地狱只是表层问题，真正麻烦的是把执行控制权交给了第三方。","tags":"回调 回调地狱 控制反转 error-first 信任 Promise","demo":"callbacks","refs":[{"b":"async-performance","c":"Callbacks"},{"b":"2-get-started","c":"Chapter 3"}],"file":"concepts/async.json"},{"id":"promise-basics","group":"async","title":"Promise 状态与链式调用","en":"Promise Chaining","level":"核心","summary":"状态一旦决议不可变；then 返回新 Promise，链上的错误会一直传到最近的 catch。","tags":"Promise pending fulfilled rejected then catch finally return 链式","demo":"promise-chain","refs":[{"b":"async-performance","c":"Promises"}],"file":"concepts/async.json"},{"id":"promise-combinators","group":"async","title":"Promise 组合器与并发控制","en":"Promise Combinators","level":"进阶","summary":"all / allSettled / race / any 语义不同；并发数量要自己限流。","tags":"Promise.all allSettled race any 并发 限流 worker池 AbortController 超时","demo":"combinators","refs":[{"b":"async-performance","c":"Appendix B"}],"file":"concepts/async.json"},{"id":"async-await","group":"async","title":"async / await 与错误","en":"async / await","level":"核心","summary":"async 函数恒返回 Promise；await 暂停的是该函数，不会阻塞主线程。","tags":"async await try catch 顶层await forEach Promise.all 微任务","demo":"async-await","refs":[{"b":"es6-beyond","c":"Async Flow Control"}],"file":"concepts/async.json"},{"id":"generators","group":"async","title":"生成器与迭代器","en":"Generators & Iterators","level":"进阶","summary":"可暂停的函数 + 统一的可迭代协议，是 for..of、展开与异步迭代的基础。","tags":"生成器 function* yield 迭代器 Symbol.iterator for..of 异步迭代","demo":"generators","refs":[{"b":"async-performance","c":"Generators"},{"b":"es6-beyond","c":"Organization"}],"file":"concepts/async.json"},{"id":"async-patterns","group":"async","title":"异步实战模式","en":"Async Patterns","level":"进阶","summary":"超时、重试、防抖节流、竞态取消与请求去重，把异步写稳。","tags":"超时 AbortController 重试 退避 竞态 防抖 节流 请求去重","demo":"async-patterns","refs":[{"b":"async-performance","c":"Appendix B"}],"file":"concepts/async.json"},{"id":"es6-scope","group":"es6","title":"let / const 与循环绑定","en":"let / const in Loops","level":"核心","summary":"for 头部的 let 为每轮迭代新建绑定，这是异步回调能拿到正确值的原因。","tags":"let const for 循环绑定 每轮迭代 for..of for..in entries","demo":"loop-let","refs":[{"b":"es6-beyond","c":"Syntax"},{"b":"2-scope-closures","c":"Chapter 5"}],"file":"concepts/es6.json"},{"id":"function-forms","group":"es6","title":"函数形态全览","en":"Function Forms","level":"进阶","summary":"声明、表达式、箭头、方法简写、生成器、async —— 按是否需要 this / new / 提升来选。","tags":"函数声明 函数表达式 箭头函数 方法简写 生成器 async name","demo":"function-forms","refs":[{"b":"2-get-started","c":"Appendix A"},{"b":"es6-beyond","c":"Syntax"}],"file":"concepts/es6.json"},{"id":"template-tagged","group":"es6","title":"模板字符串与标签模板","en":"Tagged Templates","level":"进阶","summary":"模板字符串支持多行与插值；标签函数能拿到原始片段做转义、国际化与 DSL。","tags":"模板字符串 标签模板 String.raw 插值 DSL XSS 转义","demo":"tagged-template","refs":[{"b":"es6-beyond","c":"Syntax"}],"file":"concepts/es6.json"},{"id":"symbols","group":"es6","title":"Symbol 与知名符号","en":"Symbols & Well-known Symbols","level":"进阶","summary":"唯一值作为「不会被撞名的键」，知名符号用来改写语言内建行为。","tags":"Symbol Symbol.for Symbol.iterator toStringTag 知名符号 Reflect.ownKeys","demo":"symbols","refs":[{"b":"es6-beyond","c":"Organization"},{"b":"2-types-grammar","c":"Chapter 1"}],"file":"concepts/es6.json"},{"id":"collections","group":"es6","title":"Map / Set / WeakMap","en":"Map, Set & Weak Collections","level":"核心","summary":"Map 允许任意类型键，Set 去重，Weak 系列不阻止垃圾回收。","tags":"Map Set WeakMap WeakSet 去重 SameValueZero 弱引用 内存泄漏","demo":"collections","refs":[{"b":"es6-beyond","c":"Collections"}],"file":"concepts/es6.json"},{"id":"esm-cjs","group":"es6","title":"模块化：ESM 深入","en":"ES Modules in Depth","level":"进阶","summary":"静态结构带来 tree-shaking 与循环依赖可分析性；动态 import 处理按需加载。","tags":"ESM import export 动态import tree-shaking 循环依赖 TDZ import.meta","demo":"esm","refs":[{"b":"2-scope-closures","c":"Chapter 8"},{"b":"es6-beyond","c":"Organization"}],"file":"concepts/es6.json"},{"id":"proxy-reflect","group":"es6","title":"Proxy / Reflect 与元编程","en":"Proxy & Reflect","level":"深入","summary":"用陷阱拦截对象基本操作；Reflect 提供对应的默认行为，两者常成对出现。","tags":"Proxy Reflect 陷阱 元编程 receiver 响应式 invariant 撤销代理","demo":"proxy","refs":[{"b":"es6-beyond","c":"Meta Programming"},{"b":"2-objects-classes","c":"Chapter 2"}],"file":"concepts/es6.json"},{"id":"compile-jit","group":"engine","title":"解析、字节码与 JIT","en":"Parsing & JIT","level":"深入","summary":"源码先被解析成 AST 与字节码，热代码才被优化编译；优化可能因假设失效而回退。","tags":"JIT AST 字节码 Ignition TurboFan 去优化 内联缓存 懒解析","demo":"jit","refs":[{"b":"2-get-started","c":"Chapter 1"},{"b":"async-performance","c":"Program Performance"}],"file":"concepts/engine.json"},{"id":"hidden-class","group":"engine","title":"隐藏类与内联缓存","en":"Hidden Classes & IC","level":"深入","summary":"引擎给对象形状编号，属性访问按形状缓存偏移；形状频繁变化会让缓存失效。","tags":"隐藏类 形状 Shape 内联缓存 IC 单态 多态 delete TypedArray","demo":"hidden-class","refs":[{"b":"async-performance","c":"Benchmarking & Tuning"}],"file":"concepts/engine.json"},{"id":"gc-memory","group":"engine","title":"垃圾回收与常见泄漏","en":"GC & Memory Leaks","level":"进阶","summary":"可达性决定生死；泄漏几乎都是「还被引用着」，不是引擎忘了回收。","tags":"垃圾回收 GC 可达性 内存泄漏 堆快照 WeakMap removeEventListener","demo":"gc","refs":[{"b":"2-scope-closures","c":"Chapter 7"},{"b":"async-performance","c":"Program Performance"}],"file":"concepts/engine.json"},{"id":"workers","group":"engine","title":"Web Worker 与真正的并行","en":"Web Workers","level":"进阶","summary":"把 CPU 密集任务挪到独立线程，用消息传递交换可结构化克隆的数据。","tags":"Web Worker 并行 postMessage 结构化克隆 Transferable SharedArrayBuffer 线程池","demo":"workers","refs":[{"b":"async-performance","c":"Program Performance"}],"file":"concepts/engine.json"},{"id":"benchmarking","group":"engine","title":"基准测试与性能陷阱","en":"Benchmarking","level":"进阶","summary":"先测真实场景再优化；微基准容易被 JIT、死代码消除与 GC 干扰。","tags":"基准测试 performance.now 微基准 JIT 死代码消除 强制同步布局 性能剖析","demo":"benchmark","refs":[{"b":"async-performance","c":"Benchmarking & Tuning"}],"file":"concepts/engine.json"},{"id":"strict-mode","group":"engine","title":"严格模式与语言边界","en":"Strict Mode","level":"核心","summary":"\"use strict\" 把静默错误变成显式异常，也是 class 与 ESM 的默认状态。","tags":"use strict 严格模式 隐式全局 with eval class ESM","demo":"strict-mode","refs":[{"b":"2-get-started","c":"Chapter 1"},{"b":"types-grammar","c":"Grammar"}],"file":"concepts/engine.json"}],"quizGroups":[{"id":"scope","name":"作用域与闭包","count":12},{"id":"thisproto","name":"this · 对象 · 原型","count":10},{"id":"types","name":"类型与值","count":12},{"id":"coercion","name":"强制转换与相等","count":10},{"id":"grammar","name":"语法与运算符","count":6},{"id":"async","name":"异步与事件循环","count":12},{"id":"es6","name":"ES6+ 与模块化","count":8},{"id":"engine","name":"引擎 · 性能 · 工程化","count":6}],"cheatList":[{"id":"ch-typeof","title":"typeof 结果","cat":"类型"},{"id":"ch-falsy","title":"假值清单与 Boolean 转换","cat":"转换"},{"id":"ch-coerce","title":"常见值转换对照","cat":"转换"},{"id":"ch-eq","title":"== 经典案例","cat":"转换"},{"id":"ch-this","title":"this 绑定规则优先级","cat":"this"},{"id":"ch-precedence","title":"运算符优先级（高 → 低）","cat":"语法"},{"id":"ch-order","title":"异步执行顺序","cat":"异步"},{"id":"ch-combinators","title":"Promise 组合器","cat":"异步"},{"id":"ch-array","title":"数组方法速查","cat":"ES6+"},{"id":"ch-es6","title":"ES6+ 特性速查","cat":"ES6+"}],"challengeList":[{"id":"ex-hoist","title":"提升：声明与赋值分离","topic":"hoisting-tdz"},{"id":"ex-loop","title":"循环与闭包：var vs let","topic":"loop-let"},{"id":"ex-this","title":"this：隐式绑定丢失","topic":"this-binding"},{"id":"ex-order","title":"事件循环：同步 / 微 / 宏","topic":"microtasks"},{"id":"ex-coerce","title":"强制转换：+ 与 ==","topic":"equality"},{"id":"ex-tdz","title":"TDZ：typeof 也不安全","topic":"hoisting-tdz"},{"id":"ex-promise","title":"Promise 链：忘记 return","topic":"promise-basics"},{"id":"ex-proto","title":"原型委托与属性屏蔽","topic":"prototype-chain"},{"id":"ex-destructure","title":"解构默认值与浅拷贝","topic":"destructure"},{"id":"ex-async-await","title":"await 与 forEach","topic":"async-await"},{"id":"ex-set","title":"Set 去重与 NaN","topic":"collections"},{"id":"ex-asif","title":"ASI 与 return 换行","topic":"asi"},{"id":"ex-arrow","title":"箭头函数与词法 this","topic":"arrow-this"},{"id":"ex-generator","title":"生成器双向传值","topic":"generators"}]}