DEV Community

keepoSteepo
keepoSteepo

Posted on

Breakpoints & Strict Mode

BREAKPOINTS AND STRICT MODE

Breakpoints are locations where the browser will pause the program, this enables the programmer to know if the error has occurred at that point of the script’s execution.

One can use breakpoints in the Google Chrome browser on a Mac by first right clicking on the page and then going to “Inspect”. On the line of code, to the left, there are three dots. Once clicked, after the options appear, proceed to “Break on” and select from the available options.

The purpose of using breakpoints when debugging your code is so that you can systematically figure out where the error in your code is. Since the code will only be run until the breakpoint, one can then progressively debug code.

Strict mode forces JavaScript to strictly apply syntax rules. The use of strict mode enables the script to run faster and more efficiently. It also encourages good programming technique since syntax error will result in load-time or run-time errors.

The way to run strict mode is by inputting the “use strict”; statement on the first line of the file.

Top comments (0)