Your code will not be right the first time and that’s okay. Debugging is a very important thing to do. If you understand how to debug well, you will be able to code better and more efficiently.
When the program reaches that line, it will be paused. This will only do this if you have the console open in your web browser, for me that is Google Chrome. Let’s run through what I most commonly use
Here I mostly look at “Watch” and “Scope”. With “Watch” you will have to enter something that you want to keep you eye on. Such as a variable that keeps changing, or an Array that keeps getting stuff pushed into it. Here I have an object, and everything in there looks to be fine. There other thing I watch is “Scope”. More importantly, “Local”
Here, I can usually see what “This” is. “This” is a very important keyword and its always good to see what it is referring to. For this app, I am using react and it is telling my things about the component, such as functions, state, and props.
The last tool and the one I use the most is the console
The other thing that people will do is console.log.
As you can see, it will throw whatever “this.props.entry” is into the console. And that isn’t a bad thing. Sometimes having them is a good reminder on what something is. However I don’t recommend to use them in every situation.
Debugging is a great skill to have. Master it, and you won’t be sitting there for hours wondering what exactly went wrong, and why your code isn’t working.