Home Web Front-end JS Tutorial How to check for unknown JavaScript errors

How to check for unknown JavaScript errors

Jun 30, 2021 am 10:28 AM
javascript

How to find unknown javascript errors: first run the javascript page; then click the browser's settings icon and find "Developer Tools" in "More Tools"; finally open the tool and refresh the page. You see error messages on the console.

How to check for unknown JavaScript errors

The operating environment of this article: windows7 system, Google87.0&&javascript1.8.5 version, Dell G3 computer.

How to check for unknown JavaScript errors?

Write a test code first. The script is very simple. It just displays the results of a and b on the page.

How to check for unknown JavaScript errors

Run the page, and you can see that the correct results are output on the page.

How to check for unknown JavaScript errors

But if we make a mistake, write the code of a b in a bb, as shown in the figure

How to check for unknown JavaScript errors

Run page , the page does not display correct data, but no error is reported, and it does not affect the operation of the page.

How to check for unknown JavaScript errors

#In order to find this potential error, we can use the browser's developer tools.

Click the browser's settings icon, and then find 'Developer Tools' (Chrome browser) in 'More Tools'

(Press the shortcut key F12 or other shortcut keys, different browsing The shortcut keys are different for different systems)

How to check for unknown JavaScript errors

After opening the tool, refresh the page, and you can see a red error on the console, which prompts us that the variable bb is not defined. .

How to check for unknown JavaScript errors

You can also click to activate this button in the debugging page (source), which will enter the interrupt when an exception is encountered.

How to check for unknown JavaScript errors

After activation, refresh the page, you can see that the interruption is immediately entered, which makes it easier for us to find what went wrong.

How to check for unknown JavaScript errors

[Related recommendations: javascript advanced tutorial]

The above is the detailed content of How to check for unknown JavaScript errors. For more information, please follow other related articles on the PHP Chinese website!

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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to implement an online speech recognition system using WebSocket and JavaScript How to implement an online speech recognition system using WebSocket and JavaScript Dec 17, 2023 pm 02:54 PM

How to implement an online speech recognition system using WebSocket and JavaScript

WebSocket and JavaScript: key technologies for implementing real-time monitoring systems WebSocket and JavaScript: key technologies for implementing real-time monitoring systems Dec 17, 2023 pm 05:30 PM

WebSocket and JavaScript: key technologies for implementing real-time monitoring systems

How to implement an online reservation system using WebSocket and JavaScript How to implement an online reservation system using WebSocket and JavaScript Dec 17, 2023 am 09:39 AM

How to implement an online reservation system using WebSocket and JavaScript

How to use JavaScript and WebSocket to implement a real-time online ordering system How to use JavaScript and WebSocket to implement a real-time online ordering system Dec 17, 2023 pm 12:09 PM

How to use JavaScript and WebSocket to implement a real-time online ordering system

JavaScript and WebSocket: Building an efficient real-time weather forecasting system JavaScript and WebSocket: Building an efficient real-time weather forecasting system Dec 17, 2023 pm 05:13 PM

JavaScript and WebSocket: Building an efficient real-time weather forecasting system

Simple JavaScript Tutorial: How to Get HTTP Status Code Simple JavaScript Tutorial: How to Get HTTP Status Code Jan 05, 2024 pm 06:08 PM

Simple JavaScript Tutorial: How to Get HTTP Status Code

How to use insertBefore in javascript How to use insertBefore in javascript Nov 24, 2023 am 11:56 AM

How to use insertBefore in javascript

How to get HTTP status code in JavaScript the easy way How to get HTTP status code in JavaScript the easy way Jan 05, 2024 pm 01:37 PM

How to get HTTP status code in JavaScript the easy way

See all articles