Javascript Output

There are different ways of displaying information in JavaScript. for example:

  • document.write
  • window.alert

document.write

Document.Write is one of the methods of displaying data using JavaScript. Document.Write will display results in HTML.

  • For displaying messages we can place message in double quotes.
  • For displaying HTML we can use Document.Write and place html code in double quotes.
  • For any calculations we don’t need to use double quotes.

window.alert

window.alert can be used to display data in alert format.

  • For displaying messages we can place message in double quotes.
  • For displaying HTML we can use window.alert and place html code in double quotes.
  • For any calculations we don’t need to use double quotes.