in javascript atleast declaration is must before usage of variable but in the following code the variable i in the for loop is used without declaration and the code is working fine..... why???
<body>
<form>
<input type="button" onclick="multi(a)" value="click here" >
</form>
<script type="text/javascript" language="javascript">
<!--
var a;
function multi(a){
a=parseInt(prompt("Enter a value","your value goes here"));
for(i=1;i<=10;i++){
document.write(a+"X"+i+"="+a*i+"<br />");
}
}
-->
</script>
</body>