Home > Web Front-end > JS Tutorial > Example of how Chrome debugs JavaScript

Example of how Chrome debugs JavaScript

黄舟
Release: 2017-08-09 11:17:13
Original
1933 people have browsed it

In website and front-end development, JavaScript is a powerful scripting language, but many people love and hate it, and sometimes directly ignore its importance. Of course, there are many ways to debug js. Firebug under ff and ie also have very powerful debugging tools. Here I will show you how to debug js in chrome.


1. Open the demo with chrome browser

Example of how Chrome debugs JavaScript


2. Press the f12 key

Example of how Chrome debugs JavaScript


##3. Add breakpoint

Example of how Chrome debugs JavaScript


4. Monitor variables

Example of how Chrome debugs JavaScript

Example of how Chrome debugs JavaScript

5. Check the console input log

Example of how Chrome debugs JavaScript


6.demo code:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Examples</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">
</head>
<body>
    
</body>
</html>
<script>
    
     var cnt = (function () {
        var index = 0;
        var add = function () {
            return ++index;
        };
        return add;

    })();
    var c=cnt();
    alert(c);
    console.log(c);

</script>
Copy after login

The above is the detailed content of Example of how Chrome debugs JavaScript. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template