Javascript Variable Initilization
In this section, you will learn about javascript variable initilization. Javascript provides you to do programming at the client side.
Systax for declearing variable :
var a;
Initilization javascript variable:
var a = 10;
Following example you will see the variable initialization and print on running document or window:
Variable initilization Code :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script language="javascript" type="text/javascript">
var a = 10;
document.write(a);
</script>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Javascript variable</title>
</head>
<body>
</body>
</html>
|
If you want to try it online then you click on bellow link and test it.
Try online