JavaScript Examples
Windows
- Popup Window - onClick
- Popup Window - Unobtrusive
- Timed Redirect - onClick
- Timed Redirect - Unobtrusive
- Refresh Page - onClick
- Refresh Page - Unobtrusive
- Refresh Page Automatically
Dialogs/Boxes
- Alert Box - onClick
- Alert Box - Unobtrusive
- Confirmation Box - onClick
- Confirmation Box - Unobtrusive
- Jump Menu with Conditional Confirmation Box - Unobtrusive
- Basic Prompt - onClick
- Basic Prompt - Unobtrusive
- Conditional Prompt - Unobtrusive
- "Print this Page" - onClick
- "Print this Page" - Unobtrusive
Dates
- Current Date/Time
- Current Date/Time - Locale String
- Current Date/Time - Locale String with Locale Examples
- Current Date - MM/DD/YYYY
- Current Date - DD/MM/YYYY
- Current Time - 24hr
- Current Time - 12hr
- Current Date - Long Format (e.g. Saturday, November 26, 2016)
- Current Date - Short Format (e.g. Sat, Nov 26, 16)
Loops
- "For" Loop
- "While" Loop
- "Do While" Loop
- Break a "For" Loop
- Break a "While" Loop
- Break & Continue a "For" Loop
- Break & Continue a "While" Loop
- "For In" Loop (loop through the enumerable properties of an object)
- Nested "For" Loop
- Nested "While" Loop
JavaScript Math
Math.ceil()
Math.floor()
Math.max()
Math.min()
Math.PI
Math.pow()
Math.round()
Math.sqrt()
Random Numbers
Math.random()
Math.random()
as a rounded integer- Function: Random Integer (Max Excluded)
- Function: Random Integer (Max Included)
JavaScript Arrays
- Create an Array
- Concatenate Two Arrays
- Concatenate Three Arrays
- Join Array Elements into a String
- Remove last Element from Array
- Remove first Element from Array
- Add elements to the end of an Array
- Add elements to the beginning of an Array
- Sort Array Alphabetically (Ascending)
- Sort Array Alphabetically (Descending)
- Reverse an Array
- Extract Elements from an Array
Conditional Statements
- JavaScript "If" Statement
- JavaScript "If Else" Statement
- JavaScript "If Else If" Statement
- JavaScript "Switch" Statement
- JavaScript Conditional (ternary) Operator