Skip to content

Commit

Permalink
2024-05-23 13:24:00
Browse files Browse the repository at this point in the history
  • Loading branch information
wizardforcel committed May 23, 2024
1 parent fbbb74f commit f546012
Show file tree
Hide file tree
Showing 2 changed files with 1,031 additions and 0 deletions.
63 changes: 63 additions & 0 deletions totrans/ms-js_00.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
prefs:
- PREF_H1
type: TYPE_NORMAL
zh: 序言
- en: It would seem that everything that needs to be written about JavaScript has
been written. Frankly, it is difficult to find a topic related to JavaScript that
has not been discussed ad nauseam. However, JavaScript is changing at a rapid
Expand All @@ -21,27 +22,33 @@
id: totrans-1
prefs: []
type: TYPE_NORMAL
zh: 似乎已经写下了所有需要关于JavaScript的东西。坦白说,要找到一个关于JavaScript还没有被详尽讨论的话题是困难的。然而,JavaScript正在迅速变化。ECMAScript
6有潜力改变这门语言以及我们用它编写的代码方式。Node.js已经改变了我们用JavaScript编写服务器的方式。像React和Flux这样的新想法将推动语言的下一轮迭代。虽然我们花时间学习新特性,但不可否认的是,必须掌握JavaScript的基础理念。这些理念是基础且需要关注。如果你已经是一个有经验的JavaScript开发者,你会意识到现代JavaScript与大多数人所知的那门语言大相径庭。现代JavaScript要求特定的风格纪律和思维的严谨性。工具变得更加强大,并逐渐成为开发工作流程的一个重要组成部分。尽管语言似乎在变化,但它建立在一些非常坚实且恒定的理念之上。这本书强调的就是这些基本理念。
- en: While the book was being written, things kept changing in the JavaScript landscape.
Luckily, we were able to include all the important and relevant updates in this
book.
id: totrans-2
prefs: []
type: TYPE_NORMAL
zh: 在撰写这本书的过程中,JavaScript领域的很多事情都在不断变化。幸运的是,我们成功地在这本书中包括了所有重要的相关更新。
- en: '*Mastering JavaScript* provides you with a detailed overview of the language''s
fundamentals and some of the modern tools and libraries, such as jQuery, Underscore.js,
and Jasmine.'
id: totrans-3
prefs: []
type: TYPE_NORMAL
zh: 《精通JavaScript》为你提供了对语言基础和一些现代工具和库(如jQuery、Underscore.js和Jasmine)的详细概述。
- en: We hope that you enjoy this book as much as we enjoyed writing it.
id: totrans-4
prefs: []
type: TYPE_NORMAL
zh: 我们希望你能像我们享受写作一样享受这本书。
- en: What this book covers
id: totrans-5
prefs:
- PREF_H1
type: TYPE_NORMAL
zh: 本书内容概览
- en: '[Chapter 1](part0014_split_000.html#DB7S1-437400f9e6be4fb8bff7752407036263
"Chapter 1. JavaScript Primer"), *JavaScript Primer*, focuses on the language
constructs without spending too much time on the basic details. We will cover
Expand All @@ -51,6 +58,8 @@
id: totrans-6
prefs: []
type: TYPE_NORMAL
zh: '[第1章](part0014_split_000.html#DB7S1-437400f9e6be4fb8bff7752407036263 "第1章 JavaScript
入门"),*JavaScript 入门*,专注于语言构造,而不花太多时间在基本细节上。我们将涵盖变量作用域和循环的更复杂部分以及使用类型和数据结构的最佳实践。我们还将涵盖大量的代码风格和推荐的代码组织模式。'
- en: '[Chapter 2](part0018_split_000.html#H5A41-437400f9e6be4fb8bff7752407036263
"Chapter 2. Functions, Closures, and Modules"), *Functions, Closures and Modules*,
covers the core of the language intricacies. We will discuss the complexities
Expand All @@ -60,6 +69,7 @@
id: totrans-7
prefs: []
type: TYPE_NORMAL
zh: '[第2章](part0018_split_000.html#H5A41-437400f9e6be4fb8bff7752407036263 "第2章 函数、闭包和模块"),*函数、闭包和模块*,涵盖了语言复杂性的核心。我们将讨论使用函数方面以及在JavaScript中对待闭包的不同处理方法的复杂性。这是一个谨慎且详尽的讨论,将为你进一步探索更高级的设计模式做好准备。'
- en: '[Chapter 3](part0030_split_000.html#SJGS1-437400f9e6be4fb8bff7752407036263
"Chapter 3. Data Structures and Manipulation"), *Data Structures and Manipulation*,
takes a detailed look at regular expressions and arrays. Arrays are a fundamental
Expand All @@ -69,6 +79,7 @@
id: totrans-8
prefs: []
type: TYPE_NORMAL
zh: '[第3章](part0030_split_000.html#SJGS1-437400f9e6be4fb8bff7752407036263 "第3章 数据结构及其操作"),*数据结构及其操作*,详细介绍了正则表达式和数组。数组是JavaScript中的一个基本数据类型,本章将帮助你有效地使用数组。正则表达式可以使你的代码简洁—我们将详细介绍如何在你的代码中有效地使用正则表达式。'
- en: '[Chapter 4](part0042_split_000.html#181NK2-437400f9e6be4fb8bff7752407036263
"Chapter 4. Object-Oriented JavaScript"), *Object-Oriented JavaScript*, discusses
object orientation in JavaScript. We will discuss inheritance and the prototype
Expand All @@ -78,6 +89,9 @@
id: totrans-9
prefs: []
type: TYPE_NORMAL
zh: 第4章[《面向对象的 JavaScript》](part0042_split_000.html#181NK2-437400f9e6be4fb8bff7752407036263
"第4章 面向对象的 JavaScript"),讨论了 JavaScript 中的面向对象。我们将讨论继承和原型链,并专注于理解 JavaScript 提供的原型继承模型。我们还将讨论这个模型与其他面向对象模型的不同之处,以帮助
Java 或 C++ 程序员熟悉这种变化。
- en: '[Chapter 5](part0047_split_000.html#1CQAE1-437400f9e6be4fb8bff7752407036263
"Chapter 5. JavaScript Patterns"), *JavaScript Patterns*, discusses common design
patterns and how to implement them in JavaScript. Once you master the object-oriented
Expand All @@ -86,6 +100,8 @@
id: totrans-10
prefs: []
type: TYPE_NORMAL
zh: 第5章[《JavaScript 模式》](part0047_split_000.html#1CQAE1-437400f9e6be4fb8bff7752407036263
"第5章 JavaScript 模式"),讨论了常见的设计模式以及如何在 JavaScript 中实现它们。一旦你掌握了 JavaScript 的面向对象模型,理解设计和编程模式就会更容易,写出模块化且易于维护的代码。
- en: '[Chapter 6](part0058_split_000.html#1NA0K2-437400f9e6be4fb8bff7752407036263
"Chapter 6. Testing and Debugging"), *Testing and Debugging*, covers various modern
methods to test and debug issues in JavaScript code. We will also explore continuous
Expand All @@ -94,105 +110,130 @@
id: totrans-11
prefs: []
type: TYPE_NORMAL
zh: 第6章[《测试与调试》](part0058_split_000.html#1NA0K2-437400f9e6be4fb8bff7752407036263
"第6章 测试与调试"),涵盖了各种现代方法来测试和调试 JavaScript 代码中的问题。我们还将探讨 JavaScript 的持续测试和测试驱动方法。我们将使用
Jasmine 作为测试框架。
- en: '[Chapter 7](part0061_split_000.html#1Q5IA1-437400f9e6be4fb8bff7752407036263
"Chapter 7. ECMAScript 6"), *ECMAScript 6*, focuses on the newer language features
introduced by ECMAScript 6 (ES6). It makes JavaScript more powerful and this chapter
will help you understand the newer features and how to use them in your code.'
id: totrans-12
prefs: []
type: TYPE_NORMAL
zh: 第7章[《ECMAScript 6》](part0061_split_000.html#1Q5IA1-437400f9e6be4fb8bff7752407036263
"第7章 ECMAScript 6"),专注于由 ECMAScript 6 (ES6) 引入的新语言特性。它使 JavaScript 更加强大,本章将帮助你理解新特性以及如何在代码中使用它们。
- en: '[Chapter 8](part0065_split_000.html#1TVKI2-437400f9e6be4fb8bff7752407036263
"Chapter 8. DOM Manipulation and Events"), *DOM Manipulation and Events*, takes
a detailed look at JavaScript as a language of the browser. This chapter discusses
DOM manipulation and browser events.'
id: totrans-13
prefs: []
type: TYPE_NORMAL
zh: 第8章[《DOM 操作与事件》](part0065_split_000.html#1TVKI2-437400f9e6be4fb8bff7752407036263
"第8章 DOM 操作与事件"),详细探讨了 JavaScript 作为浏览器语言的部分。本章讨论了 DOM 操作和浏览器事件。
- en: '[Chapter 9](part0074_split_000.html#26I9K2-437400f9e6be4fb8bff7752407036263
"Chapter 9. Server-Side JavaScript"), *Server-Side JavaScript*, explains how we
can use Node.js to write scalable server systems in JavaScript. We will discuss
the architecture of Node.js and several useful techniques.'
id: totrans-14
prefs: []
type: TYPE_NORMAL
zh: 第9章[《服务器端 JavaScript》](part0074_split_000.html#26I9K2-437400f9e6be4fb8bff7752407036263
"第9章 服务器端 JavaScript"),解释了如何使用 Node.js 在 JavaScript 中编写可扩展的服务器系统。我们将讨论 Node.js
的架构和一些有用的技术。
- en: What you need for this book
id: totrans-15
prefs:
- PREF_H1
type: TYPE_NORMAL
zh: 本书你需要什么
- en: 'All the examples in this book can be run on any modern browser. For the last
chapter, you will need Node.js. You will need the following prerequisites to run
the examples and samples from this book:'
id: totrans-16
prefs: []
type: TYPE_NORMAL
zh: 本书中的所有示例都可以在任何现代浏览器上运行。对于最后一章,你需要 Node.js。为了运行本书中的示例和样本,你需要以下先决条件:
- en: A computer with Windows 7 or higher, Linux, or Mac OS X installed.
id: totrans-17
prefs:
- PREF_UL
type: TYPE_NORMAL
zh: 安装有 Windows 7 或更高版本、Linux 或 Mac OS X 的计算机。
- en: The latest version of the Google Chrome or Mozilla Firefox browser.
id: totrans-18
prefs:
- PREF_UL
type: TYPE_NORMAL
zh: 最新版本的 Google Chrome 或 Mozilla Firefox 浏览器。
- en: A text editor of your choice. Sublime Text, vi, Atom, or Notepad++ would be
ideal. The choice is entirely yours.
id: totrans-19
prefs:
- PREF_UL
type: TYPE_NORMAL
zh: 你选择的文本编辑器。Sublime Text、vi、Atom 或 Notepad++ 都是理想的选择。完全由你决定。
- en: Who this book is for
id: totrans-20
prefs:
- PREF_H1
type: TYPE_NORMAL
zh: 本书适合谁
- en: 'This book is intended to equip you with the details necessary to master JavaScript.
This book will be useful for the following audience:'
id: totrans-21
prefs: []
type: TYPE_NORMAL
zh: 本书旨在为你提供掌握 JavaScript 的必要细节。本书将对以下读者群体有用:
- en: Experienced developers familiar with other object-oriented languages. Information
in this book will enable them to transition to JavaScript using their existing
experience.
id: totrans-22
prefs:
- PREF_UL
type: TYPE_NORMAL
zh: 有经验的开发者,熟悉其他面向对象语言。本书的信息将使他们能够利用现有的经验转向 JavaScript。
- en: Web developers with some amount of experience with JavaScript. This book will
help them learn advanced concepts of JavaScript and refine their programming style.
id: totrans-23
prefs:
- PREF_UL
type: TYPE_NORMAL
zh: 有一定经验的 Web 开发者。这本书将帮助他们学习 JavaScript 的高级概念并完善他们的编程风格。
- en: Beginners who want to understand and eventually master JavaScript. This book
has the necessary information for them to get started.
id: totrans-24
prefs:
- PREF_UL
type: TYPE_NORMAL
zh: 初学者想要理解并最终掌握 JavaScript。这本书为他们提供了开始所需的信息。
- en: Conventions
id: totrans-25
prefs:
- PREF_H1
type: TYPE_NORMAL
zh: 约定
- en: In this book, you will find a number of text styles that distinguish between
different kinds of information. Here are some examples of these styles and an
explanation of their meaning.
id: totrans-26
prefs: []
type: TYPE_NORMAL
zh: 在这本书中,您会发现有一些文本样式用于区分不同类型的信息。以下是一些这些样式的示例及其含义解释。
- en: 'Code words in text, database table names, folder names, filenames, file extensions,
pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "First,
the `<script>` tag in `<head>` imports JavaScript, while the second `<script>`
tag is used to embed inline JavaScript."'
id: totrans-27
prefs: []
type: TYPE_NORMAL
zh: 文本中的代码单词、数据库表名、文件夹名、文件名、文件扩展名、路径名、假 URL、用户输入和 Twitter 处理方式如下所示:"首先,`<head>`中的`<script>`标签导入了
JavaScript,而第二个`<script>`标签用于嵌入内联 JavaScript。"
- en: 'A block of code is set as follows:'
id: totrans-28
prefs: []
type: TYPE_NORMAL
zh: 代码块如下所示:
- en: '[PRE0]'
id: totrans-29
prefs: []
Expand All @@ -203,6 +244,7 @@
id: totrans-30
prefs: []
type: TYPE_NORMAL
zh: 当我们要引您注意代码块中的某个特定部分时,相关的行或项目会被加粗:
- en: '[PRE1]'
id: totrans-31
prefs: []
Expand All @@ -212,6 +254,7 @@
id: totrans-32
prefs: []
type: TYPE_NORMAL
zh: 任何命令行输入或输出都如下所示:
- en: '[PRE2]'
id: totrans-33
prefs: []
Expand All @@ -223,83 +266,103 @@
id: totrans-34
prefs: []
type: TYPE_NORMAL
zh: '**新术语** 和 **重要词汇** 以粗体显示。例如,在菜单或对话框中看到的屏幕上的词,会在文本中这样显示:"You can run the page
and inspect using Chrome''s **Developer Tool**"'
- en: Note
id: totrans-35
prefs:
- PREF_H3
type: TYPE_NORMAL
zh: 注意
- en: Warnings or important notes appear in a box like this.
id: totrans-36
prefs: []
type: TYPE_NORMAL
zh: 警告或重要说明以这样的盒子出现。
- en: Tip
id: totrans-37
prefs:
- PREF_H3
type: TYPE_NORMAL
zh: 提示
- en: Tips and tricks appear like this.
id: totrans-38
prefs: []
type: TYPE_NORMAL
zh: 技巧和建议以这样的形式出现。
- en: Reader feedback
id: totrans-39
prefs:
- PREF_H1
type: TYPE_NORMAL
zh: 读者反馈
- en: Feedback from our readers is always welcome. Let us know what you think about
this book—what you liked or disliked. Reader feedback is important for us as it
helps us develop titles that you will really get the most out of.
id: totrans-40
prefs: []
type: TYPE_NORMAL
zh: 读者对我们书籍的反馈总是受欢迎的。让我们知道您对这本书的看法——您喜欢或不喜欢的地方。读者反馈对我们很重要,因为它帮助我们开发出您会真正从中受益的标题。
- en: To send us general feedback, simply e-mail `<[feedback@packtpub.com](mailto:feedback@packtpub.com)>`,
and mention the book's title in the subject of your message.
id: totrans-41
prefs: []
type: TYPE_NORMAL
zh: 要发送给我们一般性反馈,只需电子邮件 `<[feedback@packtpub.com](mailto:feedback@packtpub.com)>`,并在您消息的主题中提到书的标题。
- en: If there is a topic that you have expertise in and you are interested in either
writing or contributing to a book, see our author guide at [www.packtpub.com/authors](http://www.packtpub.com/authors).
id: totrans-42
prefs: []
type: TYPE_NORMAL
zh: 如果您在某个主题上有专业知识,并且有兴趣撰写或贡献一本书,请查看我们的作者指南:[www.packtpub.com/authors](http://www.packtpub.com/authors)。
- en: Customer support
id: totrans-43
prefs:
- PREF_H1
type: TYPE_NORMAL
zh: 客户支持
- en: Now that you are the proud owner of a Packt book, we have a number of things
to help you to get the most from your purchase.
id: totrans-44
prefs: []
type: TYPE_NORMAL
zh: 既然您已经成为 Packt 图书的自豪拥有者,我们有很多事情可以帮助您充分利用您的购买。
- en: Downloading the example code
id: totrans-45
prefs:
- PREF_H2
type: TYPE_NORMAL
zh: 下载示例代码
- en: You can download the example code files from your account at [http://www.packtpub.com](http://www.packtpub.com)
for all the Packt Publishing books you have purchased. If you purchased this book
elsewhere, you can visit [http://www.packtpub.com/support](http://www.packtpub.com/support)
and register to have the files e-mailed directly to you.
id: totrans-46
prefs: []
type: TYPE_NORMAL
zh: 您可以从您在 [http://www.packtpub.com](http://www.packtpub.com) 的账户上下载本书中的示例代码文件,您购买的
Packt Publishing 所有的书籍都可以。如果您在其他地方购买了这本书,您可以访问 [http://www.packtpub.com/support](http://www.packtpub.com/support)
注册,以便将文件直接通过电子邮件发送给您。
- en: Downloading the color images of this book
id: totrans-47
prefs:
- PREF_H2
type: TYPE_NORMAL
zh: 下载本书彩色图片
- en: We also provide you with a PDF file that has color images of the screenshots/diagrams
used in this book. The color images will help you better understand the changes
in the output. You can download this file from [https://www.packtpub.com/sites/default/files/downloads/MasteringJavaScript_ColorImages.pdf](https://www.packtpub.com/sites/default/files/downloads/MasteringJavaScript_ColorImages.pdf).
id: totrans-48
prefs: []
type: TYPE_NORMAL
zh: 我们还为您提供了一个 PDF 文件,其中包含本书中使用的屏幕快照/图表的彩色图片。这些彩色图片将帮助您更好地理解输出中的变化。您可以从 [https://www.packtpub.com/sites/default/files/downloads/MasteringJavaScript_ColorImages.pdf](https://www.packtpub.com/sites/default/files/downloads/MasteringJavaScript_ColorImages.pdf)
下载这个文件。
- en: Errata
id: totrans-49
prefs:
- PREF_H2
type: TYPE_NORMAL
zh: 勘误
- en: Although we have taken every care to ensure the accuracy of our content, mistakes
do happen. If you find a mistake in one of our books—maybe a mistake in the text
or the code—we would be grateful if you could report this to us. By doing so,
Expand Down
Loading

0 comments on commit f546012

Please sign in to comment.