The output can be display by using four different ways which are listed below:
This method sets or returns the HTML content of an element. You can also say that it is used to access an element.
document.getElementById('cool').innerHTML = "Hello world!";
document.write('How are you?');
You can use alert box to display data. The alert box is mostly used when you want an information to come through to the user. It is displayed with a message and an OK button.
alert(" HEY!" )
NOTE: These are both the same syntax.