JavaScript console
looking at JavaScript variables without displaying them
Last updated
looking at JavaScript variables without displaying them
Last updated
For debugging purposes, we can output any processed data without directly affecting the program using console logging or console.log
:
We can access the console
by
loading the page that contains the script on the browser
right-clicking on the page
clicking on "Inspect" (or similar)
finding the "Console" tab:
Thus, we can see what happens to our code without directly displaying it on the browser!
In app.js
once again, we could use console.log
as a calculator:
...checking a variable made of other variables:
Wwe can see how console.log
enables us to see outputs of sensitive calculations without showing them directly on the webpage!