JavaScript Programs

Most JavaScript programs contain many JavaScript statements. The statements are executed, one by one, in the same order as they are written. In this example, x, y, and z are given values, and finally z is displayed:

HTML file: Displayed by browser:
<p>JavaScript code (or just JavaScript) is a list of JavaScript statements.</p>
<p id="demo"></p>
<script>
    var x = 5;
    var y = 6;
    var z = x + y;
    document.getElementById("demo").innerHTML = z;
</script>

JavaScript code (or just JavaScript) is a list of JavaScript statements.

JavaScript programs (and JavaScript statements) are often called JavaScript code.

BackTable of ContentsNext