JavaScript can “display” data in different ways:

  1. Writing into an HTML element, using innerHTML.

    Changing the innerHTML property of an HTML element is a common way to display data in HTML.

  2. Writing into the HTML output using document.write().
    • Using document.write() after an HTML document is fully loaded, will delete all existing HTML.

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

  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 data.

Yonggoo Noh

I am interested in Computer science and Mathematics.