The basic JavaScript building block is the statement. Each statement represents a single command, and statements are usually terminated by a semicolon (;). The semicolon is optional, but using them makes your code easier to read and allows for multiple statements on a single line. Listing 5-3 shows a pair of statements in a script that is defined using a script element.
Listing 5-3. Using JavaScript Statements in the jsdemo.html File
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
<script src=”angular.js”></script>
<script type=”text/javascript”>
console.log(“This is a statement”);
console.log(“This is also a statement”);
</script>
</head>
<body>
This is a simple example
</body>
</html>
The browser executes each statement in turn. In this example, I simply write a pair of messages to the console. The results are as follows:
This is a statement
This is also a statement
Source: Freeman Adam (2014), Pro AngularJS (Expert’s Voice in Web Development), Apress; 1st ed. edition.