JavaScript Statements


JavaScript is a sequence of statements to be executed by the browser.

JavaScript Is Case Sensitive
Unlike HTML, JavaScript is case sensitive.

JavaScript Statements
A JavaScript statement is a command to the browser. It is normal to add a semicolon at the end of each executable statement. The semicolon is optional, and the browser is supposed to interpret the end of the line as the end of the statement. Using semicolons makes it possible to write multiple statements on one line.

JavaScript Code
JavaScript code (or just JavaScript) is a sequence of JavaScript statements. Each statement is executed by the browser in the sequence they are written:

<script type="text/javascript">
  document.write( "<h1>This is a header</h1>"  );
  document.write( "<p>This is a paragraph</p>" );
</script>

JavaScript Blocks
JavaScript statements can be grouped together in blocks. Blocks start with a left curly bracket {, and ends with a right curly bracket }. The purpose of a block is to make the sequence of statements execute together:

<script type="text/javascript">
  {
     document.write( "<h1>This is a header</h1>"  );
     document.write( "<p>This is a paragraph</p>" );
  }
</script>



Demonstration
The following demonstration shows how the script of HTML and JavaScript is displayed on the Web.

     





      Do not argue with an idiot.    
      He will drag you down to his level and beat you with experience.