To Lecture Notes

IT 238 -- May 14, 2025

Review Exercises

  1. How many times does this for loop execute?
    var m = 10000;
    var n = 20000;
    var count = 0;
    for(let i = 1; i <= m; i++) {
        for(let j = 1; j <= n; j++) {
            count++;
        }
    }
    document.writeln("Count = " + count);
    
    Answer: 10,000 * 20,000 = 200,000,000 (200 million). The reason is that the inner loop executes 20,000 times for each time that the outer loop executes. Therefore multiply the numbers to get the total number of times that the inner loop and count++ executes.
  2. What is the difference between the CSS properties margin and padding?
    Answer: padding is space between the border and the contents of the element; margin is space between the border and the neighboring element or document border.
  3. What is the difference between the CSS properties display and visibility for an HTML element?
    Answer: When the display property is set to "none", the item no longer takes up space and the neighboring elements close up the space around the item.  When the visibility property is set to "hidden", the invisible element still takes the same amount of space as when it was visible.

Project 2b

Practice Quiz 5b

The jQuery JavaScript Library

Basic jQuery Syntax

Some jQuery Examples

JavaScript querySelector Method