JavaScript can display data in many 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()

The document.write() method should only be used for testing.

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