[Debug] Debugger Statements
2024-09-03 14:17:29
For example you have the following code;
function reverse(str) {
let reversed = "";
for (let char of str) {
reversed = char + reversed;
}
return reversed;
} module.exports = reverse;
If you want to debug is in Node, you can do:
function reverse(str) {
let reversed = "";
for (let char of str) {
debugger; // add debugger
reversed = char + reversed;
}
return reversed;
} reverse("awefw"); // call the function module.exports = reverse;
Then in cmd, run:
node inspect index.js
Then just type 'continue' or just 'c'.
It will pause on liine of 'debugger;' Now for example you want to see, what is the variable 'str':
you can type: 'repl':
Then after you enter 'str', you will see the output.
最新文章
- 【转】windows环境下安装win8.1+Mac OS X 10.10双系统教程
- 完美C++(第5版)(双色)
- noi 2989 糖果
- C/C++获取系统时间
- Linux 中open系统调用实现原理【转】
- 狗狗40题~(Volume B)
- org.elasticsearch.bootstrap : JNA not found. native methods will be disabled
- JAVA 命令行参数解析,org.apache.commons.cli的使用
- springboot打包不同环境配置与shell脚本部署
- MFC映射
- 网络流24题——分配问题 luogu 4014
- springboot缓存注解——@CacheEvict
- Kubernetes实战(一):k8s v1.11.x v1.12.x 高可用安装
- 你还在为无法完美卸载SQL Server 2008 R2而烦恼吗?
- IAR for stm8 memory窗口的功能
- homewor
- Codeforces 801C Voltage Keepsake(二分枚举+浮点(模板))
- Gunicorn+Flask中重复启动后台线程问题
- OC开发_Storyboard——AutoLayout
- ueditor与mvc4中坑 -编辑时显示源码问题
热门文章
- TP5.1框架中的模型关联
- C++ STL String学习 (待续)
- fiddler笔记:快捷工具栏
- Devexpress xaf BO中字段为RuleRequiredField必输字段时,文本标签默认添加*标记
- 解决python在cmd运行时导入包失败,出现错误信息 ";ModuleNotFoundError: No module named ***";
- MySQL - 性能优化 &; MySQL常见SQL错误用法(转载)
- 浅谈后缀数组SA
- Lua虚拟机中的数据结构与栈
- Swagger学习(二、配置swagger)
- iOS UIControl 事件的说明(转)