Secrets of the JavaScript Ninja, Second Edition cover

Secrets of the JavaScript Ninja, Second Edition

Rating 4.2
Word count
605K words
Chapters
21
ISBN
9787115473264

Tags

Summary

Secrets of the JavaScript Ninja, Second Edition is an advanced JavaScript guide co-authored by John Resig, creator of jQuery, together with Bear Bibeault and Josip Maras. The Simplified Chinese edition was published by Posts & Telecom Press in 2018; it runs 429 pages and about 605,000 characters. Unlike introductory books that catalog syntax and APIs, this one focuses on the parts of JavaScript most easily skipped over yet decisive for code quality: functions, scope and closures, prototypes and objects, collections, regular expressions, modularity, and on the browser side the DOM, events, and cross-browser compatibility. The book has four parts: Warm-up, Understanding Functions, Digging into Objects, and Knowing the Browser. Part One lays out the basic groundwork—JavaScript's evolution, the browser runtime and page-building process, and debugging and testing. Part Two devotes four chapters to functions, moving from definitions and arguments and invocation patterns to closures and scope, then to generators and promises. Part Three covers object-oriented programming and prototypes, controlling property access, arrays and Map/Set, regular expressions, and code modularization. Part Four returns to the browser, covering DOM manipulation, the event mechanism, and cross-browser development techniques. The book incorporates new features from ECMAScript 6 and 7 and includes end-of-section exercises with an answer appendix, so readers can write and verify code as they read.

Editor's review

市面上的 JavaScript 书大致分两类:一类把语法和 API 从头列到尾,另一类专门讲清“为什么”。这本书属于后者。作者 John Resig 是 jQuery 的创建者,他非常熟悉浏览器环境下的各种问题,因此讲闭包、原型、事件时,不满足于讲清楚“怎么写”,还会说明“为什么这样设计”“什么情况下会出问题”。全书结构很清晰:先热身,再讲函数,然后深入对象,最后回到浏览器。前半部分帮你理清函数、作用域、原型这些基础机制;后半部分则涉及 DOM 操作、事件派发、跨浏览器兼容和模块化。书中的示例代码短小,便于动手验证;每章末尾还配有练习题。它不追求覆盖所有新语法,而是帮你把最核心的机制真正掌握;读完再看框架源码或面试题,会轻松很多。如果你已经用过一两年 JavaScript,却总觉得基础不够扎实,这本就是适合你的补课书。第2版新增了 ES6/ES7 内容,比第1版更贴合当下开发。

Who it's for

A good fit for

  • 有一两年 JavaScript 使用经验、想系统夯实函数与原型基础的开发者
  • 准备前端进阶面试、需要深入理解闭包、作用域与事件机制的求职者
  • 想读懂 jQuery 等主流库源码、理解其设计思路的前端工程师
  • 在课程或培训中学过 JS 语法,但缺少系统实践与原理讲解的学习者

Not a good fit for

  • 完全没有编程基础、需要从 HTML/CSS 和基本语法学起的新手
  • 只想快速查找 API 用法、把书当手册翻阅的读者
  • 只做后端或非 Web 开发、不关心 DOM 与浏览器兼容问题的人

Reading tips

  1. 先通读第1、2章建立运行时与页面构建的整体图景,再进入函数部分精读。
  2. 每章的示例代码亲手敲一遍并在控制台调试,练习做完后再对照附录C的答案。
  3. 读第5、7章时同步复习闭包和原型链,可用自己项目里的代码做验证。
  4. 第4部分的 DOM 与事件章节可配合浏览器开发者工具,边读边观察事件流与执行顺序。

About the publisher

Posts & Telecom Press China · Founded in 1953

Posts & Telecom Press is known for its strengths in science and technology, computing, and information and communications titles, and has extended its publishing into photography, art, software learning, and inspirational growth, giving it a fairly diverse range. Its catalog includes computing and communications works such as Refactoring and Patterns (Revised Edition) and Huawei Switch Learning Guide (Second Edition), alongside bilingual collector's editions such as The Little Prince (Chinese-English-French illustrated collector's edition), The Great Gatsby, and Three Days to See. Beijing Ten Years: 1980-1990 and Ghost Blade: WLOP Personal Illustration Collection reflect its presence in photography and art. Its authors include Antoine de Saint-Exupéry, Helen Keller, Joshua Kerievsky, Wang Da, Zhang Zhaozeng, and WLOP.

Contents

  1. Part 1 Warm-up
  2. Chapter 1 JavaScript Is Everywhere
  3. Chapter 2 Building Pages in the Runtime
  4. Part 2 Understanding Functions
  5. Chapter 3 First Lessons in Functions: Definitions and Arguments
  6. Chapter 4 Advanced Functions: Understanding Function Invocation
  7. Chapter 5 Mastering Functions: Closures and Scope
  8. Chapter 6 Functions of the Future: Generators and Promises
  9. Part 3 Digging into Objects and Fortifying Your Code
  10. Chapter 7 Object-Oriented Programming and Prototypes
  11. Chapter 8 Controlling Access to Objects
  12. Chapter 9 Working with Collections
  13. Chapter 10 Regular Expressions
  14. Chapter 11 Code Modularization
  15. Part 4 Knowing the Browser
  16. Chapter 12 DOM Manipulation
  17. Chapter 13 Events Through the Ages
  18. Chapter 14 Cross-Browser Development Techniques
  19. Appendix A Additional ES6 Features
  20. Appendix B Testing and Debugging Tools
  21. Appendix C Exercise Answers

FAQ

这本书适合零基础学 JavaScript 吗?
不太适合。本书假定读者已经会用 JavaScript 写代码,重点讲函数、闭包、原型、DOM 与事件背后的机制。零基础读者建议先看入门书或系统教程掌握语法,再回来读这本。
第1版和第2版有什么区别?
第2版由 John Resig、Bear Bibeault 与 Josip Maras 共同改写,加入 ECMAScript 6 与 7 的相关内容,并大幅调整结构,新增生成器与 promise、Map/Set、模块化等章节,中文版共 429 页。
书中的示例用的是什么风格的代码?
示例以简洁的独立片段为主,用来演示某个语言机制或浏览器行为,并配有分节小结与练习。读者需要在浏览器控制台或 Node 环境中自行运行、修改代码后加以验证。
读完能直接上手框架开发吗?
这本书不教某个框架的用法,而是帮你掌握框架底层依赖的机制,例如闭包、原型、属性访问、事件与模块化。打好这些基础后再学框架,会更容易理解其实现原理。

Comments

Find this book

This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.

More by the same author

Top rated in the same category