前言
最近开发的时候发现,Chrome
开发者调试工具中多了Step
按钮,主要是为了步入进函数内调试代码。那么之前我们已经有了Step into next function call
,可以步入进函数调试。为什么Chrome
还要新出step
呢?

Step into next function call与Step'的区别

Step into next function call:执行异步函数后,异步函数后面的代码无法断点到。快捷键F11
。
Step:执行异步函数后,异步函数后面的代码可以断点到。快捷键F9
。
实验
<html>
<script>
debugger
setTimeout(() => {
alert(‘B’);
}, 2000);
console.log(‘A’);
</script>
</html>
Step into next function call:执行异步函数setTimeout
后,异步函数后面的代码console.log(‘A’)
无法断点到。
Step:执行异步函数setTimeout
后,异步函数后面的代码console.log(‘A’)
可以被断点到。
实验在线案例为:https://codepen.io/huihui/pen/poZpggJ
网友评论