# js调试

1. 直接用鼠标点击打断点，代码执行到这一块时会停止，可以查看当前环境的变量，以及全局变量。可以在控制台打印这些变量，或是改变他们的值。也可以把函数改变，就是重新再写一遍。**注意：得是执行时停在这一块，才会拥有当前环境的上下文,也就是局部变量。**
2. 条件断点： 还是用鼠标打断点，然后右键断点，选择 **edit  breakpoiint  ,**&#x4F1A;出现一个input 输入框，输入一些条件表达式。 当满足这个条件时才会执行这个断点，停下来。例如 在for 循环里打断点，这样每一次循环都会停下来，但是我只想第5次停下来 ，就可以 在断点处 设置环境 **i ==5** &#x20;
3. 报错提示： 点亮  **Pause on exceptions**  (出现错误时暂停一下)  ，比如一个未定义的函数。当执行到这个函数时不会立马报错，也就是不会立马执行它，会先提示这个地方有错误，具体是什么错误。当继续点击执行时才会执行报错。不管这个有错误的地方有没有断点。
4. Dom 元素打断点：点击dom 元素，右键 选择 **Break on  ,** 有三种dom 改变的断点方式， 子节点变化 、自己的属性变化（style）、节点被移除 。会跳到改变他的函数里。
5.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sekin.gitbook.io/myjs/liu-lan-qi-diao-shi/jsdiao-shi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
