Page 187 - Web Applications (803) Class 12
P. 187

>>           Signed right shift    Allows the rightmost bits to fall off and copies
                                                                    of the leftmost bit to be pushed in from the left.
                                >>>           Zero fill right shift  By pushing zeros in from the left, it shifts right
                                                                    and lets the rightmost pieces fall off.


                                0    0    1   1                                           1    0   1    0





                  Replacement                                                                              Replacement
                       Bit                                                                                      Bit

                      0         0    0    0   1    1    Discarded    Discarded       1    0    1   0    0         0


                                 One bit Right Shift                                 One bit Right Shift
                 typeof Operator

                 typeof is a type checking operator in JavaScript that returns the datatype of the operand passed to it. The
                 argument for the type of operator can be any variable, function, or object whose type you want to determine.
                 Example:
                    <script>

                    document.write(typeof 'UMBRELLA'+"<br>")
                    document.write(typeof 786 +"<br>")
                    document.write(typeof FALSE +"<br>")
                    document.write(typeof true)
                    </script>
                 Output of the preceding program is as follows:













                 Following is a list of return values for the typeof Operator:

                                           Type String                             Return Type

                             Number                                   “number”
                             String                                   “string”
                             Boolean                                  “boolean”

                             Object                                   “object”
                             Function                                 “function”

                             Undefined                                “undefined”
                             Null                                     “object”

                                                                                          Web Scripting—JavaScript   185
   182   183   184   185   186   187   188   189   190   191   192