Adding breakpoints to your code will make debugging much easier. The final tip that I will leave you with is the humble breakpoint. You can find more information about what can do in the debugger console, here. You can obviously use the debug console to do the same things as you could within the usual browser console tab. First, let’s create a really simple JavaScript file. Instead of having to type out document.querySelector() you can use $ as a quick reference. In this post, we will look at how to beautify a JavaScript file in Visual Studio Code using the Beautify extension. The benefit of using the console to access elements is that you get access to a handy shortcut. Once the debugger has launched and attached, you can also use it to query the element on the page. Using console.log() isn't the only useful feature of the debug console. Get data from an API on page load, render it out here □□□ This technique can be useful when you don't want to leave VS-Code and you want to check data. In your debug console you should now see the output of your console.log statement. On the screen that pops up, click the 'Run and Debug' button. In the side ribbon, click on the 'Run and Debug' option, or, use the shortcut key Control + Shift + J. Next, log out some data using normal console.log() as can be seen below: Add a script tag and add some JavaScript to it. Luckily, debugging an HTML page that contains JavaSCript is super simple using VS Code.įirst, the best debugging tip is learning how to write to the debug console. Learning how to debug your code is an essential step to becoming a coding legend □□□♂️□□□□. In this tutorial, you will learn how to use the Visual Studio Code debugger.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |