《JavaScript高级程序设计》(第4版) P95,4.3.1 第三段 第二行
垃圾回收程序运行的时候,会标记内存中存储的所有变量(记住,标记方法有很多种)。然后,它会将所有在上下文中的变量,以及被在上下文中的变量引用的变量的标记去掉。在此之后再被加上标记的变量就是待删除的了,原因是任何在上下文中的变量都访问不到它们了。随后垃圾回收程序做一次内存清理,销毁带标记的所有值并回收他们的内存。
英文版原文:When the garbage collector runs, it marks all variables stored in memory (once again, in any number of ways). It then clears its mark off of variables that are in context and variables that are referenced by in-context variables. The variables that are marked after that are considered ready for deletion, because they can’t be reached by any in-context variables. The garbage collector then does a memory sweep, destroying each of the marked values and reclaiming the memory associated with them.
译者明显没有正确理解原文,译文多了个“再”字,导致语义完全错误。
正确的译文应该是:在此之后带有标记的变量就是待删除的了,因为上下文中的任何变量都无法访问到它们。
此处吐槽《JavaScript高级程序设计》(第4版)的翻译