Page 192 - Web_Application_v2.0_C12_Fb
P. 192

The list of keywords is as follows:

                                    await       break        case         catch       class
                                    const       continue     debugger     default     delete
                                    do          else         export       extends     finally

                                    for         function     if           import      in
                                    instanceof  new          return       super       switch
                                    this        throw        try          typeof      var
                                    void        while        with         yield


              Comments

              A comment is used to add notes in your code or to disable sections of code without deleting them. Comments
              are ignored by the JavaScript interpreter. There are two types of comments in JavaScript: single line and multi-
              line. Single line comments are added by using // and multi-line comments are added by using /* and */.
              For example:
                // alert("Hello"); Single line comment

                /* a = 10;
                b = 20; Multiline comment
                */
              Operators

              Operators are special symbols  that  are used to perform mathematical, logical, and  relational operations
              on values and variables. The variables or values on which the operators work are called operands. Some
              commonly used  operators  in  JavaScript  are  arithmetic  operators,   assignment operators or  shorthand
              assignment operators, comparison operators, logical operators, etc.
              Arithmetic Operators

              Arithmetic  operators are  used  to  perform mathematical  operations  on  numbers in JavaScript.  JavaScript
              provides the following arithmetic operators:

               Operator      Name                           Description                         Example       Output
                                                                                             (a = 11, b = 4)
                   +      Addition      Adds two operands.                                       a + b          15

                   –      Subtraction   Subtracts the operand written on the right-hand side  of   a – b        7
                                        the operator from the operand written on the left side.

                   *      Multiplication Multiplies both operands.                               a * b          44
                   /      Division      Divides numerator by denominator.                        a / b         2.75

                   %      Modulus       Divides numerator by denominator and returns the remainder.  a % b      3
                   **     Exponent      Calculates the base to the exponent power, that is base^   b**2         16
                                        exponent

                  ++      Increment     Used to increase the value of a variable by 1.            ++a           12

                   --     Decrement     Used to decrease the value of a variable by 1.            --a           10


                190   Touchpad Web Applications (Ver. 2.0)-XII
   187   188   189   190   191   192   193   194   195   196   197