Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 109 - CodePilot V5.0 C8
P. 109

    let num1=5;

                     num1=10;
                     var num2=25;

                     document.write("The ratio between both numbers is:"+ num1+":"+num2);
                     </SCRIPT>

                     </BODY>
                     </HTML>

                     KEYWORDS
                     Keywords are reserved words in JavaScript that have been assigned a specific meaning or task.

                     They cannot be used for any other purpose. Common JavaScript keywords include:

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

                     extends        false         finally        for           function      if             implements

                     import         in            instanceof     interface     let           new            null

                     package        private       protected      public        return        super          switch

                     static         this          throw          try           true          typeof         var

                     void           while         with           yield

                     OPERATORS

                     Operators are symbols used to perform mathematical, logical and relational operations on values
                     and variables. The values or variables they operate on are called operands. Common JavaScript
                     operators include arithmetic, assignment, comparison and logical operators.

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

                                                                                                   Example
                     Operator        Name                         Description                                   Output
                                                                                                 (a = 11, b = 4)

                          +      Addition        Adds two operands.                                  a + b         15
                          –      Subtraction     Subtracts the operand written on the                a – b          7
                                                 right-hand side of 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

                                                                                                                      107
                                                                                                JavaScript for Beginners

| 104 105 106 107 108 109 110 111 112 113 114 |