In the example below, we create a variable called userName and assign the value "John1234" to it.
Then we "output" the value inside an HTML paragraph with id="test"
Then we "output" the value inside an HTML paragraph with id="test"
<!DOCTYPE html>
<html>
<body>
<div id="test"></div>
<script>
var userName = "John1234";
document.getElementById("test").innerHTML = userName;
</script>
</body>
</html>