How to use Global in JavaScript

In this article I am going to explain about JavaScript Global.
  • 1658

JavaScript Global

JavaScript provide some properties and method that can be use with all built-in-JavaScript object. There some method and properties that comes in Global.

Global Properties

  • Infinity - A numeric value that represent positive and negative.
  • Nan - Not a number value
  • Undefined - Defined a variable that not assign value. 

Global Method

  • String() - Convert a object value in string format.
  • Number() - Convert a object value in number format.
  • Esacape() - Encode a string
  • ParesFloat() - Parse a string and return floating point number.
  • EncodeURL() - Encode a Url.
  • isNan() - Determines whether a value is an illegal number

Example:-

<html>

<head>

    <script type="text/javascript">

        function Myfun() {

 

 

            document.write(parseFloat("77") + "<br />");

            document.write(parseFloat("10.34") + "<br />");

            document.write(parseFloat("34 46 66") + "<br />");

            document.write(parseFloat(" 72 ") + "<br />");

        }

 

    </script>

</head>

<body>

    <button onclick="Myfun()">

        Click</button>

</body>

</html>

 

Output


 globle.gif

Further Readings

You may also want to read these related articles :here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2013 dotNetheaven. All rights reserved.