JavaScript Statements


JavaScript Statements

JavaScript statements are composed of:

Values, Operators, Expressions, Keywords, and Comments.

This statement tells the browser to write "Hello Dolly." inside an HTML element with id="demo":

 let x, y, z;    // Statement 1

x = 5;          // Statement 2
y = 6;          // Statement 3
z = x + y;      // Statement 4


Semicolons separate JavaScript statements.

Add a semicolon at the end of each executable statement:


let a, b, c;  // Declare 3 variables
a = 5;        // Assign the value 5 to a
b = 6;        // Assign the value 6 to b
c = a + b;    // Assign the sum of a and b to c

Comments

Popular posts from this blog

C Program to Display the ATM Transaction

Java programming language

Python Program to Print all Prime Numbers in an Interval