What is a Statement?

So far, we've seen some components that make up the vocabulary for a programming language, such as variables, operators, and keywords. JavaScript uses this vocabulary to form "statements" or instructions that run in a web browser. This article describes several of the types and groups of keywords used in JavaScript statements. We'll drive into JavaScript keywords in the next section.

If you have programmed in another language, you will notice that statements in JavaScript use a similar syntax to Java, C++, or Python. Most statements contain one or several lines of code that perform a task. For example, a "declaration-statement" creates a variable, a "conditional-statement" handles a decision, and a "looping-statement" executes code many times. JavaScript statements written on one line do not require a semicolon (";"), but it is best practice to end each line with one. 

Statements and declarations

JavaScript applications consist of statements with an appropriate syntax. A single statement may span multiple lines. Multiple statements may occur on a single line if each statement is separated by a semicolon. This isn't a keyword, but a group of keywords.


Source: Mozilla, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements
Creative Commons License This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.