Basic JavaScript
JavaScript Statements, Comments and Blocks
JavaScript Variables
JavaScript Conditional If ... Else
JavaScript Popup Boxes
JavaScript Functions
JavaScript Loops
Basic JavaScript
Write text with JavaScript
Write HTML tags with JavaScript
JavaScript in body section
JavaScript in head section
External JavaScript 1
External JavaScript 2
[Top of page]
JavaScript Statements, Comments and Blocks
JavaScript statements
Single line comments
Multiple line comments
Single line comment to prevent execution
Multiple lines comment to prevent execution
[Top of page]
JavaScript Variables
Declare a variable, assign a value to it and display it
[Top of page]
JavaScript Conditional If ... Else
If statement
If...else statement
Switch statement
[Top of page]
JavaScript Popup Boxes
Alert box
Alert box with line breaks
Confirm box
Prompt box
[Top of page]
JavaScript Functions
Call a function
Function with an argument
Function with an argument 2
Function that returns a value
Function with arguments, that returns a value
[Top of page]
JavaScript Loops
For loop
Looping through HTML headers
While loop
Do While loop
Break a loop
Break and continue a loop
Use a for...in statement to loop through the elements of an array
[Top of page]