# 3DE code editor

**URL:** <https://talk.code3dgames.com/t/3de-code-editor/505>\
**Category:** Uncategorized\
**Created:** [June 13, 2022, 3:25am UTC](https://talk.code3dgames.com/t/3de-code-editor/505 "2022-06-13T03:25:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![code](https://talk.code3dgames.com/user_avatar/talk.code3dgames.com/code/32/74_2.png) [@code](https://talk.code3dgames.com/u/code)\
**Post date:** [June 13, 2022, 3:25am UTC](https://talk.code3dgames.com/t/3de-code-editor/505/1 "2022-06-13T03:25:19Z")

</div>

老师，您在书中讲述了如何使用3DE或JavaScript控制台排除语法错误，但并不能排除算法错误。比如想计算A+B=多少，如果写成这样就错了：

```auto
var a=12,b=33;
var c=a+b;
console.log(c);

```

我想学会如何设置断点调试，另外，如果您有出第三版，可以加入这些内容。

---

<div class="post-metadata">

**Author:** ![chris](https://talk.code3dgames.com/user_avatar/talk.code3dgames.com/chris/32/5_2.png) [@chris](https://talk.code3dgames.com/u/chris)\
**Post date:** [June 13, 2022, 3:45am UTC](https://talk.code3dgames.com/t/3de-code-editor/505/2 "2022-06-13T03:45:16Z")

</div>

断点调试超出了初学者的水平。 所以我不太可能将它包含在第三版中。

我发现 console.log() 是一个很好的工具，即使是用于算法调试。

考虑以下：

```javascript
var a = 5;
var b = 4;
var c = a - b; 
if (c < 0) {
  gameOver();
}

```

我的意思是输入 b - a，但输入的是 a - b。 起初我可能看不到我的错误。 所以我可以使用 console.log() 来查看是否达到条件语句：

```javascript
var a = 5;
var b = 4;
var c = a - b; 
if (c < 0) {
  console.log('Here!');
  gameOver();
}

```

当我发现没有达到条件语句时，我可以使用 console.log() 来查看我的错误：

```javascript
var a = 5;
var b = 4;
var c = a - b; 
console.log(c);
if (c < 0) {
  console.log('Here!');
  gameOver();
}

```

然后我可以纠正我的错误：

```javascript
var a = 5;
var b = 4;
var c = b - a; 
if (c < 0) {
  gameOver();
}

```

我确实使用断点进行调试。 它们很强大，但是 console.log() 对于这类书来说已经足够了。

我希望这能回答你的问题。我希望我通过谷歌翻译做出的回应是有意义的。

-Chris
