
javascript where to declare variables

Javascript variable always be declared inside script tag.
<script>
var x=15;
var y=16;
var sum=x+y;
document.writeln("Sum ="+sum);
</script>
For more information, visit the following link:

JavaScript where to declare variables
To declare a variable in JavaScript me must follow the syntax. As given below
Syntax
<script language="javascript"> // declare variable or do your calculation </script>"
See an example given below that show how to declare a variable in JavaScript.
<Script Language="JavaScript">
var name, age;
name = Java;
age = 7;
document.write(name);
document.write("<br>");
document.write(age);
</Script>
In the above example name and age are two variable and further we have assigned some value to it. Always remember that the variable name must be written in small letters. document.write (); is used to print the value of variable.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.