js24
Java Script in 24 Hours - Hour 5:






Brad's Week 3 Examples

Brad's Week 4 Examples

Brad's Week 5 Examples





Chapter 5 - JS In 24 Hours

Table 5.1 (pg. 67) Common Java Script Operators

Operator Description Example
+ Concatenate (combine) strings message+"this is" = " a test";
+ Add result = 5 + 7;
- Substract score = score - 1;
* Multiply total = quantity * price;
/ Divide average = sum / 4;
% Modulo (remainder) remainder = % 4;
++ Increment tries++;
-- Decrement total--;


pg.68 - Use parentheses to control Operator Precedence when needed.

HTML and JavaScript code =

results:





pg.70 - parseInt() converts strings to integers.

HTML and JavaScript code =

results:





pg.71 - object-oruented syntax.

HTML and JavaScript code =

results:





listing 5.1 pg.71 - Assigning Values to Strings and Combining Them

HTML and JavaScript code =

results:
click for result -

HTML file "JS in 24 hours" - listing 5.1




pg.72 - Calculating a String's Length

HTML and JavaScript code =

results:





pg.73 - Converting the String's Case

HTML and JavaScript code =

results:





pg.74 - substring Using Part of a String

HTML and JavaScript code =

results:





pg.75 - substring Getting a Single Character

HTML and JavaScript code =

results:





pg.75 - substring Finding a Substring

HTML and JavaScript code =

results:





pg.76 - arrays - Creating a Numeric Array

HTML and JavaScript code =

results:





pg.77 - arrays - Understanding Array Length

HTML and JavaScript code =

results:





pg.77a - arrays - Accessing Array Elements

HTML and JavaScript code =

results:





pg.78 - string arrays - Creating a String Array

HTML and JavaScript code =

results:





pg.78 - string arrays - Splitting a String

HTML and JavaScript code =

results:





pg.79 - string arrays - Sorting a String Array

HTML and JavaScript code =

results:





pg.79 - string arrays - Sorting a Numeric Array

HTML and JavaScript code =

results:





Listing 5.2-5.3, pg.80 - string arrays - Sorting and Displaying Names

HTML and JavaScript code =

results:

Sorting String Arrays

Enter two or more names in the field below, and the sorted list of names will appear in the text area.

Name:

Sorted Names

HTML file "JS in 24 hours" - listing 5.2