一 html代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JS断点调试法</title>
<!--外部js-->
<script src="resource/js/jsdemo1.js"></script>
</head>
<body>
<h1>代码调试</h1>
<!--JS代码也可以写在这里-->
</body>
</html>
二 JS代码
var socre = 80;
if (socre > 60 && socre < 70) {
console.log("一般");
} else if (socre >= 70 && socre < 80) {
console.log("良好");
} else {
console.log("其他");
}
三 调试方法截图
1 谷歌浏览器,单击F12,进入开发者模式。
2 进入Sources页签,找到要调试的js代码。
3 打断点
4 单步执行