Start the statement with var and separate the variables by comma:
<!DOCTYPE html>
<html>
<body>
<p id="test"></p>
<script>
var name = "John Doe", userName = "user58", age = 23;
document.getElementById("test").innerHTML = name + " " + userName + " " + age;
</script>
</body>
</html>
Variables declaration can span into multiple lines also:
<!DOCTYPE html>
<html>
<body>
<p id="test"></p>
<script>
var name = "John Doe",
userName = "user58",
age = 23;
document.getElementById("test").innerHTML = name + " " + userName + " " + age;
</script>
</body>
</html>
Most Helpful This Week
JavaScript convert string variable in boolean using Regex
Using jQuery add new table row on click
Example to take user input and display on screen using JavaScript
How to get selected text from a select box using jQuery?
How to scroll page to particular Div on click using jQuery?
Image Rollover Using onMouseOver and onMouseOut