Index for more_js_programs

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, PassingArrays
Sorting shows you how to use your own (e.g. numerical) sort function;
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
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.

XmasWithFunction, XmasWithOutFunction
The 12 Days of Christmas song - printed using a function in the head to sing a given day,
or with nested loops. Makes you appreciate functions.

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