Menu
Coddy logo textTech

Code Structure

Part of the Fundamentals section of Coddy's JavaScript journey — lesson 4 of 77.

JavaScript code runs from top to bottom, line by line. 

Each line of code is a command (also called a statement) that tells the computer what to do.

console.log("Hello!") // First command
console.log("How are you?") // Second command

In JavaScript, you can end each command with a semicolon (;), but it’s not required. The computer understands your code with or without it.

Both examples below work the same:

console.log("Semicolon is here!"); // With ;
console.log("No semicolon here!")  // Without ;

But adding semicolons is a good habit to avoid mistakes!

Cheat sheet

JavaScript code runs from top to bottom, line by line. Each line is a command (statement) that tells the computer what to do.

console.log("Hello!") // First command
console.log("How are you?") // Second command

You can end each command with a semicolon (;), but it's not required:

console.log("Semicolon is here!"); // With ;
console.log("No semicolon here!")  // Without ;

Try it yourself

This lesson doesn't include a code challenge.

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals