Northcentral Technical College Introduction To Programming
10-152-310
Introduction to Programming with JavaScript NTC 10-152-310

Learning Plan 5 5.3 Lab 1

# 5.3 Lab 1

#### File: /Learning Plan 5/5.3lab1.html

### Student

- Name:
- Section:
- Email:

## Lab Steps Part 1

1. Open this file in Firefox and Microsoft Visual Studio.
2. Add your name, section, and email
3. Open the file /Learning Plan 5/jsFiles/5.3lab1.js in Microsoft Visual Studio.
4. Lab Steps:
   1. Create a new function at the very top of the file and above the existing function and its comment block. Call it something like `outputMessage()`. Don't forget to add a comment block above the function.
   2. In the new function, output a message, something like, "Hi, from a function." followed by a `"<br />"` tag.
   3. Locate the function named `lab53_1Part1()`.
   4. In lab53_1Part1() call the new function several times with each call on its own line.

### Part 1 Example Output

    Hi, from a function.
    Hi, from a function.
    Hi, from a function.
    Hi, from a function.

### Part 1 Output:

## Lab Steps Part 2

1. Open this file in Firefox and Microsoft Visual Studio.
2. Add your name, section, and email
3. Locate the function named `lab53_1Part2()`.
4. Lab Steps:
   1. Create a new function below the function lab53_1Part1() and above the lab53_1Part2(). Make sure that it starts before the comment block.
   2. Give the function a good name that indicates that the function will be outputting a full name.
   3. Add a block of comments above the function. In this block, write a description of what the function does.
   4. Add three variables to the new function.
      1. One for a first name
      2. One for a middle initial
      3. One for a last name.
   5. The function will then prompt the user for first name, the middle initial, and the last name, one at a time, of course.
   6. Then output the user's full name to the page with a `document.write()`. Don't add a `"<br />"` tag to the beginning or the end of the name. Add a period (`.`) to the end of the middle initial.
   7. Locate the function named `lab53_1Part2()`.
   8. In the function lab53_1Part2(), output the first half of a greeting. You could do something like, "Hello, ".
   9. Then call the function that you wrote by writing its name. Remember to add the `();` at the end of the name of the function.
   10. Next, output the end of a greeting. Something like, ". How are you?" and a `"<br />"` tag.
   11. Now call the function again. This time don't output a greeting before you call it.
   12. Output a relevant statement, most anything you want.
   13. Save and test your program. Your output should look something like the following sample.

### Part 2 Example Output

    Hello, John T. Smith. How are you?
    Susan G. Hatch, has left the building.

### Part 2 Output: