Labs ICT
โญ Pro Login

Syntax

1 min read | JavaScript Tutorial
โญ

Want the full learning experience?

Get structured courses, certificates, projects, and instructor support with LabsICT Pro.

Explore Pro Courses

JavaScript Syntax โ€” The Rules of the Language

Every language has rules. JavaScript's syntax determines how you write statements, expressions, and structure your code. Once you learn the patterns, you'll read and write JS with confidence.

Statements are instructions the computer executes. Expressions are pieces of code that produce values. Semicolons terminate statements (though JavaScript's ASI often inserts them for you).

Basic Statement

console.log("This is a statement.");

Variable Declaration

let age = 25;
const name = "Alice";

Expression as Statement

5 + 3;
"hello".toUpperCase();

Block Statement

{
  let x = 10;
  console.log(x);
}

Conditional Statement

if (5 > 3) {
  console.log("Five is greater than three");
}

Loop Statement

for (let i = 0; i < 3; i++) {
  console.log("Count:", i);
}

Template Literal Expression

const name = "Alice";
console.log(`Hello, ${name}!`);

Destructuring Expression

const point = [10, 20];
const [x, y] = point;
console.log(x, y);

๐Ÿงช Quick Quiz

How do you end a JavaScript statement?