Reading Assignment: Console.
-
What is the console used for?
The Console is used to log information as part of the JavaScript development process, as well as allowing to interact with a web page by carrying out JavaScript expressions within the page’s context.
Essentially, the Console provides the ability to write, manage, and monitor JavaScript on demand. -
How do you open the Console in Google Chrome?
Navigate to the menu at the top-right of your browser window signified by three vertical dots in a row. From there, you can select More Tools then Developer Tools.
This will open a panel where you can click on Console along the top menu bar to bring up the JavaScript Console if it is not highlighted already.
It’s also possible to just use keyboard shortcut;
For Windows and Linux it’sCTRL
+Shift
+J
And for MacOs it’sCommand
+Option
+J
-
What does console.log function do?
Rather than have pop-up alerts that we need to continue to click out of, we can work with JavaScript by logging it to the Console with console.log and have the Output in a print format. -
How can you change the contents of an HTML page through the console?
By use the JavaScript “document” command.
F.ex.document.body.innerHTML = "<p>This is will be a paragraph text.</p>"