JavaScript 工作原理 系列文章
潘忠显 / 2021-03-31
“JavaScript 工作原理”系列文章是翻译和整理自 SessionStack 网站的 How JavaScript works。因为博文发表于2017年,部分技术或信息可能已经过时,但文章内容仍能给 JavaScript 的开发者带来很多益处。
另外,许多语言有类似的特性,这系列文章中的一些原理性的介绍,各种语言也是通用的,比如:堆栈、事件循环 (Event Loop)、垃圾收集 (GC) 等。即使不从事 JavaScript 开发,阅读这些文章也能获得收益。
我自己在2015年在刚入职时,也写过一些 JavaScript 代码,但当时没有深入的理解。今年工作涉及到 FaaS,要了解一些 JavaScript 虚拟机是如何工作的,阅读了这一系列文章,才有了一些基本的理解。对文章的翻译,一方面能帮助更多的人,另外一方面让自己对许多细节有更深、更准确理解。
有理解和翻译不准确的地方,欢迎大家留言指正。
系列文章的翻译目录
- 01 引擎、运行时和调用栈概述
- 02 V8引擎透视 + 5个编写优化代码的技巧
- 03 内存管理 + 4类常见内存泄漏的处理
- 04 事件循环和异步编程 + 利用 async/await 编码优质代码的5个技巧
- 其他文章更新中…
系列文章的原文目录
- 01 An overview of the engine, the runtime, and the call stack
- 02 Inside the v8 engine + 5 tips on how to write optimized code
- 03 Memory management + how to handle 4 common memory leaks
- 04 Event loop and the rise of async programming + 5 ways to better coding with async/await
- 05 Deep dive into websockets and http/2 with sse + how to pick the right path
- 06 A comparison with webassembly + why in certain cases it’s better to use it over javascript
- 07 The building blocks of web workers + 5 cases when you should use them
- 08 Service workers, their lifecycle and use cases
- 09 The mechanics of web push notifications
- 10 Tracking changes in the dom using mutationobserver
- 11 The rendering engine and tips to optimize its performance
- 12 Inside the networking layer + how to optimize its performance and security
- 13 Under the hood of css and js animations + how to optimize their performance
- 14 Parsing, abstract syntax trees (asts) + 5 tips on how to minimize parse time
- 15 The internals of classes and inheritance + transpiling in babel and typescript
- 16 Storage engines + how to choose the proper storage api
- 17 The internals of shadow dom + how to build self-contained components
- 18 Webrtc and the mechanics of peer to peer networking
- 19 Under the hood of custom elements + best practices on building reusable components
- 20 Exceptions + best practices for synchronous and asynchronous code
- 21 5 types of xss attacks + tips on preventing them
- 22 Csrf attacks + 7 mitigation strategies
- 23 Iterators + tips on gaining advanced control over generators