Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 72 - 2625 PortGPt V2.1
P. 72

    Let’s catch uP

                        Which attribute is used to embed external JavaScript into HTML5 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.

                           Variables

                      A variable is a name of storage location. It stores a value that can be modified later. JavaScript is a
                      loosely typed language which means it does not require a data type to be declared before using it.
                      Syntax to declare a variable in JavaScript is:

                      var <variable name> = <value>;
                      where var is a keyword, <variable name> is a valid name for the variable and <value> is the value that
                      you want to assign to the variable.

                      70    Premium Edition-VIII

| 67 68 69 70 71 72 73 74 75 76 77 |