JavaScript Output in alert Box

How to show the output on the alert box in JavaScript 



This method uses a browser alert box.
While these are incredibly useful for debugging (and learning the language), they are a horrible way to communicate with the user.
 Alert boxes will stop your scripts from running until the user clicks the OK button, and it has all the charm and grace of all those pop-up windows everyone spent so many years trying to get rid of!


Alert box JavaScript code

<html>
  <head> 
 </head> 

 <body> 

    <script type='text/javascript'>     
   alert('Hello World!');    
 </script>


  </body>

</html>