Chapter 03
JavaScript Statements
A JavaScript program is made up of statements. Each statement gives the browser an instruction to execute.
01 • Learn
What is JavaScript Statements?
- A statement is an instruction written in JavaScript.
- A program can contain many statements.
- Semicolons are commonly used to mark the end of statements.
- Statements can execute in sequence unless control-flow logic changes the execution.
02 • Syntax
Syntax
let name = 'Rahul'; let age = 20; console.log(name); console.log(age);
03 • Example
Example
Try understanding this code before running it.
let name = 'Aman'; let age = 21; let course = 'ADCA'; console.log(name); console.log(age); console.log(course);
04 • Remember
Important Points
- JavaScript is case-sensitive.
- Organizing statements line by line makes code easier to read.
- Curly braces are used to create code blocks.
- Statements should be written with correct brackets, quotes, and syntax.
05 • Avoid
Common Mistakes
- Using spaces inside variable names.
- Forgetting to close a string quote.
- Using mismatched brackets or braces.
06 • Practical
Real-World Use
JavaScript statements are used in every application to process input, perform calculations, make decisions, and update the user interface.
07 • Practice
Practice Exercise
Practice: Statements
Store your name, age, and course in three variables and display all three values in the console.
Ready to write code?
Open the JavaScript editor and run your code with live output.