Home  • Programming • JavaScript

JavaScript variable and declaration

To declare variable in javaScript you can use var keyword. However the var keyword is optional in javascript. Example:
<script>
var x;
y=6
x=20;

document.write(x+y);
</script>

Output

26

Comments 6


Copyright © 2026. Powered by Intellect Software Ltd