Skip to content

1-js/03-code-quality/01-debugging-chrome#35

Merged
leviding merged 4 commits intozh-hansfrom
transfer/debugging-chrome
Apr 24, 2018
Merged

1-js/03-code-quality/01-debugging-chrome#35
leviding merged 4 commits intozh-hansfrom
transfer/debugging-chrome

Conversation

@linhe0x0
Copy link
Copy Markdown

resolve #17

@linhe0x0 linhe0x0 changed the title 1-js/03-code-quality/01-debugging-chrome [WIP] 1-js/03-code-quality/01-debugging-chrome Apr 11, 2018
@leviding leviding added the WIP Work in process label Apr 12, 2018
@linhe0x0 linhe0x0 changed the title [WIP] 1-js/03-code-quality/01-debugging-chrome 1-js/03-code-quality/01-debugging-chrome Apr 12, 2018
@linhe0x0 linhe0x0 removed the WIP Work in process label Apr 12, 2018
@linhe0x0 linhe0x0 self-assigned this Apr 12, 2018
@allenlongbaobao
Copy link
Copy Markdown
Contributor

校对认领

@leviding
Copy link
Copy Markdown
Member

@allenlongbaobao ok

Copy link
Copy Markdown
Contributor

@allenlongbaobao allenlongbaobao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

校对完毕,没有什么问题 @sqrthree @leviding

在编写更复杂的代码前,让我们先来聊聊调试吧。

All modern browsers and most other environments support "debugging" -- a special UI in developer tools that makes finding and fixing errors much easier.
所有的现代浏览器和大多数其他环境都支持 “调试” —— 开发者工具中的一个特殊的 UI,可以让你更容易地发现和修复错误。
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[“调试”] => [「调试」]

1. The **Resources zone** lists HTML, JavaScript, CSS and other files, including images that are attached to the page. Chrome extensions may appear here too.
2. The **Source zone** shows the source code.
3. The **Information and control zone** is for debugging, we'll explore it soon.
1. **资源区域** 列出了 html、javascript、css 和包括图片在内的页面需要的其他文件。Chrome 扩展的资源也会出现在这。
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

资源区域后面不空格

2. The **Source zone** shows the source code.
3. The **Information and control zone** is for debugging, we'll explore it soon.
1. **资源区域** 列出了 html、javascript、css 和包括图片在内的页面需要的其他文件。Chrome 扩展的资源也会出现在这。
2. **源区域** 展示源码。
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

源区域后面不空格

3. The **Information and control zone** is for debugging, we'll explore it soon.
1. **资源区域** 列出了 html、javascript、css 和包括图片在内的页面需要的其他文件。Chrome 扩展的资源也会出现在这。
2. **源区域** 展示源码。
3. **信息和控制区域** 是用来调试的,我们很快就会来探讨它。
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

信息和控制区域后面不空格

## Breakpoints(断点)

Let's examine what's going on within the code of the [example page](debugging/index.html). In `hello.js`, click at line number `4`. Yes, right on the `4` digit, not on the code.
我们来看看 [示例页面](debugging/index.html) 发生了什么。在 `hello.js` 中,点击第 `4` 行。是的,就点击数字 `"4"` 上,不是点击代码。
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

示例页面前面不空格

- 快速跳转至代码中的断点(通过点击右侧面板中的对应的断点)
- 通过取消选中来临时禁用。
- 通过右键单击和选择移除来删除一个断点。
- 等等
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

句号

![](chrome-sources-breakpoint.png)

A *breakpoint* is a point of code where the debugger will automatically pause the JavaScript execution.
**断点** 是调试器会自动暂停 JavaScript 执行的地方。
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

断点后不用空格

```smart header="Conditional breakpoints"
*Right click* on the line number allows to create a *conditional* breakpoint. It only triggers when the given expression is truthy.
```smart header="条件断点"
在行号上 *右键单击* 允许你创建一个 *条件* 断点。 只有当给定的条件为真(即满足条件)时才会被触发。
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在行号上右键单击允许你创建一个条件断点。 只有当给定的条件为真(即满足条件)时才会被触发。

将右键单击和条件两处的多余空格去掉,并将斜体样式改为加粗。

请打开右侧的信息下拉列表(箭头指示出的地方)。这里允许你查看当前的代码状态:

1. **`Watch` -- shows current values for any expressions.**
1. **`Watch` -- 显示各种表达式的当前值.**
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

句号用全角

@leviding leviding merged commit a9129a5 into zh-hans Apr 24, 2018
@leviding leviding deleted the transfer/debugging-chrome branch April 24, 2018 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants