JavaScript statements are commands to the browser. What these commands do is tell the browser what to do.
First look at the following code
<script type="text/javascript">
alert("hello!");
</script>
The example alert("hello!");
is a JavaScript statement.
The end of a line is considered the end of the statement, and a semicolon is usually added at the end ";"
to indicate the end of the statement.
Look at the following piece of code, there are three statements, each with ";" at the end, execute the statements in order.
<script type="text/javascript">
document.write("I");
document.write("love");
document.write("JavaScript");
</script>
Task - Exercise 5
Now let's enter two statement and enter some content in the web page!
1. Input on line 7:
document.write("Hello");
2. Input on line 8:
document.write("world");
Task Code
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sentence recognition</title>
<script type="text/javascript">
</script>
</head>
<body>
</body>
</html>
//= htmlentities($post["body"]); ?>