How to debug code in ES6 ?
In this article, we are going to learn how to debug a code in ES6. Debugging is the process of finding and resolving the problem or mistake in code due to which it doesn’t work as expected. Debugging is an important part of programming that helps programmers to fix the bugs in the code.
Checking an error in ES6:Before debugging an error we must know where the error occurred in the code, then you can go to resolve it. In es6 we can find the error in the console section of the web browser.
Below is the way to access the console:
Right Click on browser -> Select Inspect -> Go to Console tab
Example: Basic example of error detection in the console in ES6.
Resolving errors in ES6
Using a Debugger: To Debug a code es6 provides a tool named debugger. A debugger allows the user to go at any line or function in the code to find and resolve the error.
Below is the way to access Debugger:
Right Click on browser -> Select Inspect -> Sources -> Go to your file
and debug code line by line using Debugger