Index for more_js_programs
Links to Notes and Exercises are at the bottom of this page.
rounding.html
How to round to a specified number of decimal places.
Iffy1.html
footwear.html
Using if statements
addition1.html
Simple addition game.
Includes randomInterval function to produce random integers between x and y
(inclusive).
StringMethods,StringCompares
Simple string manipulations
Increments,Increments2
How to increment a loop variable
arrays1.html arrays2.html
Simple methods for arrays - printing, storing and retrieving values.
arrays3.html
arrays4.html
Using the sort method.
Copying arrays element by element vs. assigning names.
Sorting ,
Sorting2
and PassingArrays
Sorting shows you how to use your own (e.g. numerical) sort function;
Sorting2 expands this to using deep (vs. shallow) copies;
PassingArrays shows that when an array is passed to a function the values in
the array may be permanently
changed (i.e. after return from the function), unlike what happens to variable.
SwitchLetterGradeToNumber
The case statement. Also some nice error detection.
Note this function is also used in gpa.html
moreSimpleLoops.html,
simpleLoops.html,
Exercise on Loops,
Exercise on Alphabetizing
Using for loops (without arrays), using for loops to print a table, and to fill
and print out arrays.
Sieve.html,
Sieve2.html,
Sieve3.html
Sieve of Erasthonese. An array of Booleans (trues and falses)
and some clever loops.
Sieve2 and Sieve3 have nicer printing of the results, including controlling the
number
of items printed on each line.
nestedLoops.html
Exactly what it says - some simple examples of nested for
loops.
gpa.html
Using a double array to store grades for a number of students and their gpa's.
Straightforward but useful example of double (for) loops.
doWhile.html
Examples of while and do-while loops
CustomObjects1,
CustomObjects2,
CustomObjects3
JavaScript has objects too!