What is the Console? - a development too by a web browser to be able to work with JS
- What is the console used for?
A console can be used to log information as part of the JavaScript development process, as well as allow interaction 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 Chrome window signified by three vertical dots in a row. From there, select More Tools then Developer Tools. This will open a panel, then click on Console along the top menu bar to bring up the JavaScript Console.
Or you can also enter into the JavaScript Console by using the keyboard shortcut CTRL
+ SHIFT
+ J
on Linux or Windows, or COMMAND
+ OPTION
+ J
on macOS, which will bring focus immediately to the Console.
On Mac Air, simply click the View tab, scroll down to the Developer tab, then click Javascript console.
- What does console.log function do?
The console . log () is a function that writes a message to log on the debugging console , such as Webkit or Firebug. In a browser you will not see anything on the screen. It logs a message to a debugging console.
The Console
method log()
outputs a message to the web console. The message may be a single string (with optional substitution values), or it may be any one or more JavaScript objects.
-
How can you change the contents of an HTML page through the console?
The DOM node context menu, which you may recognize from the elements panel, is also present in the console panel.
-
Log a DOM node to the console.
-
Right click on it.
-
Select Edit as HTML or Edit Text.
-
Notice the DOM is updated on the page and also in the Elements Panel.