Page 45 - trackpad v5.1 class 8 flipbook
P. 45
Step 5 Click on the OK button in the message box.
The web browser displays the web page.
Which attribute is used to embed external JavaScript into HTML5 web
uiz Bee page?
_________________________________________________________________
STATEMENTS IN JAVASCRIPT
Commands and instructions given to the
JavaScript interpreter to take some actions Subject: The confirm( ) Method
are called statements and a collection of The confirm() method displays a dialog
statements is called a script or a program. box with a specified message, along
Within almost every browser resides the with an OK and a Cancel button.
JavaScript engine, which interprets and
executes JavaScript code. We use the semicolon to terminate a statement; however, if the
statements are written in separate lines, then the semicolon can be omitted.
JavaScript statements consist of keywords, variables, operators, expressions and comments.
Let us learn about them in detail.
KEYWORDS
A keyword is a reserved word that has a special meaning for the JavaScript interpreter. Some of
the keywords of JavaScript are:
var, switch, let, for, const, function, if, return, etc.
VARIABLES
A variable is the name of storage location. It stores a value that can be modified later. JavaScript
is a loosely typed language which means it does not require a data type to be declared before
using it. The syntax to declare a variable in JavaScript is:
var <variable name> = <value>;
where var is a keyword, <variable name> is a valid name for the variable and <value> is the value
that you want to assign to the variable.
Dynamic Web Pages in HTML5 43

