CS2020:   Web Science, Sytems and Design

JavaScript: Standard Output


To write to the standard output, you use a predefined JavaScript class called document.

document class has following method (there are others like writeln(..) ,etc.) :

  • document.write("string");
    • writes the string to standard output.
    • example:
  • document.write("Hi how are you?"); //will print hi how are you to the screen.

     

     

  • Note: standard output = web-browser window.
    • So, you may want to print out HTML formatted information.
    • example:
  • documnet.write("<b>Hi, How are you?<b><br>");

© Lynne Grewe