JavaScript Syntax

JavaScript Syntax


JavaScript Syntax
JavaScript Simple Syntax is as follows:
<script…>
     JavaScript Code
</script>
JavaScript Values
There are in the JavaScript syntax defines two types of values:
  • Fixed values
  • Variable values
Fixed values are called Literals.
Variable values are called Variables.
There are in the script tag takes two important attributes −
  • Language − This attribute specifies what scripting language you are using. Typically, its value will be javascript. Although recent versions of HTML (and XHTML, its successor) have phased out the use of this attribute.
  • Type − This attribute is what is now recommended to indicate the scripting language in use and its value should be set to "text/javascript".
So your JavaScript segment will look like −
<script language = "javascript" type = "text/javascript">
   JavaScript code
</script>