- var expiryMsg; II Message displ ayed t o users
- var today ; II Today's dat e
- var el Ends ; II The element that shows the message about the offer endi ng
An object is a series of variables and functions that represent something from the world around you.
0JavaScript also has several built-in objects such as String, Number, Math, and Date. Their properties and methods offer functionality that help you write scripts.
| No | ---- |
|---|---|
| 1 | The if-else and if statements |
| 2 | Block of statements |
| 3 | Conditional expression |
| 4 | Comparison between objects |
| 5 | The switch statement |
The if-else and if statements ~ if (condition ) then-statement else else-statement • condition is an expression of type boolean, i.e., a conditional expression that is evaluated to true or false • then-statement is a single statement (also called the then-branch of the if-else statement) • else-statement is a single statement (also called the else-branch of the if-else statement)~
one of the comparison operators (==, !=, >, <, >=, or <=) applied to variables (or expressions) of a primitive type;
Example: int a, b, c; ... if (a > b + c)
a complex boolean expression, obtained by applying the boolean operators !, &&, and || to simpler expressions;
Example: int a, b, c, d; String answer; ... if ((a > (b+c)) || (a == d) && !answer.equalsIgnoreCase("YES"))
condition is an expression of type boolean, i.e., a conditional expression that is evaluated to true or false
then-statement is a single statement (also called the then-branch of the if-else statement) else-statement is a single statement (also called the else-branch of the if-else statement)
- for - loops through a block of code a number of times
- for/in - loops through the properties of an object
- for/of - loops through the values of an iterable object
- while - loops through a block of code while a specified condition is true
- do/while - also loops through a block of code while a specified condition is true
for (statement 1; statement 2; statement 3) {
// code block to be executed
}

