Hi, I am new and would appreciate some insight


Hi, I am new and enjoying this so far, however am finding some things confusing.
When and why does the command, "console.log" need to be used?
It seems to me that this command simply creates an output reading on the screen, and so
how is it dissimilar to prompt?
Also, sorry if this was the wrong place to type this.
Thank you


JavaScript can display data in different ways:

  1. Writing into an HTML element, using innerHTML.
  2. Writing into the HTML output using document.write().
  3. Writing into an alert box, using window.alert().
  4. Writing into the browser console, using console.log().

For debugging purposes, you can use the console.log() method to display some data.

This method simply creates an output in the browser console.

The prompt() method displays a dialog box that prompts the visitor for input. A prompt box is often used if you want the user to input a value before entering a page.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.