Page 146 - ComputerGenius_V2.1_Class8
P. 146

<TITLE> My First JavaScript </TITLE>

                  <SCRIPT TYPE="text/javascript" SRC="external.js">
                  </SCRIPT>
                  </HEAD>

                  <BODY>
                  This message box is displayed using external JavaScript.

                  </BODY>
                  </HTML>

                   Step 4    Save the file with .html extension and open the web page in web browser. You will get the

                            same output as the previous web page.

































                  Statements in JavaScript

                  Commands  and  instructions  given  to  the  JavaScript  interpreter  to  take  some  actions  are  called
                  statements and a collection of statements is called a script or a program. Within almost every
                  browser resides the JavaScript interpreter. We use the semicolon to terminate a statement but, if
                  the statements are written in separate lines, then the semicolon can be omitted.


                  JavaScript statements consist of keywords, variables, operators, expressions and comments. Let
                  us learn about them in detail.

                  Keywords


                  A keyword is a reserved word that has a special meaning for the JavaScript interpreter. Some of the
                  keywords of JavaScript are:

                  var,  switch,  let,  for, const,  function,  if,  return, etc.


                      144    Computer Genius (V2.1)-VIII
   141   142   143   144   145   146   147   148   149   150   151