Page 305 - Web Applications (803) Class 11
P. 305

Output:

















                 Ð ÐvalueOf( ): It returns a string’s primitive value. The original string is not changed by the method.
                   For example:
                   <!DOCTYPE html>
                   <HTML>
                   <HEAD>
                       <TITLE> ValueOf function </TITLE>
                   </HEAD>
                   <BODY>
                       <H1> Using valueOf </H1>
                   <SCRIPT>


                       text = "I am studying JavaScript";
                       result = text.valueOf();
                       document.write(result);
                   </SCRIPT>
                   </SCRIPT>
                   </BODY>
                   </HTML>















                   4.12 MATH OBJECT

                 The JavaScript Math object offers a wide range of methods that are used to simplify mathematical calculations and
                 speed up math-oriented programming. Here are a few:

                                 Math.round(x)        Number x is rounded to its nearest integer

                                 Math.ceil(x)         Number x is rounded up to its nearest integer
                                 Math.floor(x)        Number x is rounded down to its nearest integer
                                 Math.trunc(x)        Yields the integer part of the Number x


                                                                      Introduction to Dynamic Websites Using JavaScript  303
   300   301   302   303   304   305   306   307   308   309   310