Js-Statements 2
Js-Statements 2
Topperworld.in
Statements
1. Semicolons
Example:
let a, b, c;
a = 2;
b = 3;
c = a + b;
console.log("The value of c is " + c + ".");
Output:
The value of c is 5.
©Topperworld
JavaScript
2. Code Blocks
Example:
function myFunction() {
console.log("Hello");
console.log("How are you?");
}
myFunction()
Output:
Hello
How are you?
3. White Space
Example:
console.log(10 * 2);
console.log(10 * 2);
©Topperworld
JavaScript
Output:
20
20
• The best place to break a code line in Javascript, if it doesn’t fit, is after
an operator.
Example:
document.getElementById("geek1").innerHTML =
"Hello World!";
5. Keywords
©Topperworld
JavaScript
©Topperworld