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 commandIn 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 commandYou 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.
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Fundamentals
4Operators Part 2
Logical Operators Part 1Logical Operators Part 2Recap - Simple LogicLogical Operators Part 3Type Coercion7Bill Split Calculator
Welcome MessageCalculating The Tip And Total2Variables
NumbersStringBooleanNaming ConventionsEmpty VariablesRecap - Initialize VariablesConstants3Operators Part 1
Arithmetic OperatorsModulo OperatorArithmetic ShortcutsComparison OperatorsStrict vs Loose EqualityRecap - Simple Math6Basic IO
OutputOutput with VariablesType Conversion - Part 1Type Conversion - Part 2Recap - Till 120Recap - True or False