A JavaScript variable is simply a name of storage location. There are two types of variables in JavaScript : local variable and global variable.
There are some rules while declaring a JavaScript variable:.
1)Name must start with a letter (a to z or A to Z), underscore( _ ), or dollar( $ ) sign.
2)After first letter we can use digits (0 to 9),
3) JavaScript variables are case sensitive.
<html>
<body>
<script>
var x = 10;
var y = 20;
var z=x+y;
document.write(z);
</script>
</body>
</html>
0 Comment(s)