To Lecture Notes

IT 212 -- Jan 27, 2025

Practice Quiz

Review Exercises

  1. Find the errors in the source code files contained in this project:
    meters-to-ft-in.zip.
    Answer: here is a zipfile of the corrected project.
  2. Create a textfield that has rounded corners. Also, add a placeholder attribute to the textfield.
    Answer:
    Source code:
    <input type="text" value="Larry" placeholder="Enter name:"
           style="border-radius: 15px; width: 150px; height: 15px;">
    
  3. We know how to create a button that looks like this:

    <input type="button" value="Push Me">
    
    Show how to create this button with a <button> element.
    Answer:
    <button>
        Push Me
    </button>
    
    The advantage of using the button tag is that HTML markup can be included, for example:
    <button>
        <strong>Push Me</strong>
    </button>
    
  4. Test four String methods in the W3Schools documentation.
    replace  replaceAll  toUpperCase  padStart  trim
    
    Use the W3Schools documentation if needed
         www.w3schools.com/js/js_string_methods.asp
    Answer: The entire HTML file that contains the test script:
    <!DOCTYPE html>
    <html lang="en">
        <head>
            <meta charset="UTF-8">
            <title>Document</title>
            <script>
            var s = "mississippi";
            document.writeln(s.replace("s", "*") + " " + "<br>");
            // Output: mi*sissippi
            document.writeln(s.replaceAll("s", "*") + "<br>");
            // Output: mi**i**ippi
            document.writeln(s.toUpperCase( ) + "<br>");
            // Output: mississippi
            var b = "459";
            document.writeln(b.padStart(5, "0") + "<br>");
            // Output: 00459
            var c = "   This is a test. 
            document.writeln("!" + c.trim( ) + "!<br>");
            // Output: !This is a test.!
            </script>
        </head>
        <body></body>
    </html>
    
  5. What is the value of the variable f after these statements are executed?
    var a = "abc", b = 128.73, c = 45;
    var f = `###${a} %%%${b} ***${c}`;
    Answer:
    ###abc %%%128.73 ***45
    

Functions vs. Methods

Project 2a

Arrays

Properties and Methods