Beginning JavaScript with DOM Scripting and AJAX
Chapter 2: Data And Decisions
Download all as a zip file (26 KB)
The JavaScript Operators
Currency Conversion
Currency Conversion in One Line
Simple calculation (addition)
Adding a number to an entered number
Determining the type of user entered data
Using parseFloat and parseInt
Determining data types
Automatic conversion of strings to objects when reading properties
Using the String constructor
Primitive email test
Using substring to read parts of a string
Using Date
Changing a date
Rounding Numbers
Simulating a dye
A simple Array
Using indexed and associated arrays
Using an Array with variable indices and labels
A simple banner display
Using slice with Arrays
Concatenating Arrays
Splitting Arrays
Sorting Arrays
Sorting and Reversing Arrays
Comparing Strings
Using toLowerCase() for disambiguity when comparing strings
Comparing String Objects
Using valueOf() to Compare String Objects
Using if to Convert Euros to Dollars
Testing User Entered Data against a Value Range
Decreasing Readability by not Indenting Code
Using else if
Using Switch
Using for loops
Using for loops with in
Using while loops
Using do...while loops
Using break to end a while loop
Using continue to skip loop iterations
Back to index
Go to the homepage