Saturday, January 11, 2014

JavaScript Variable

<html>
<body>
<script>
    /* A variable in javascript is simply a name of storage location which is also known as identifiers. There are two types of variables in javascript : local and global.
   
    Rules for declaring a variable.

    --> Name must start with a letter (a to z or A to Z), underscore( _ ), or dollar( $ ) sign.
    --> After first letter we can use digits (0 to 9), for example value1.
    --> Javascript variables are case sensitive, for example x and X are different variables.*/

    var x = 10;
    var y = 20; 
    var z=x+y; 
    document.write(z); 
    var _value="MaHi"
    document.write(_value);
</script>
</body>
</html>

No comments:

Post a Comment