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

Learning Plan 5 5.1 Lab 1

# 5.1 Lab 1

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

### Student

- Name:
- Section:
- Email:

### Lab Steps

1. Open this file in Firefox and Microsoft Visual Studio.
2. Add your name, section, and email.
3. Open Microsoft Visual Studio and create a new empty file.
4. Save it into the `/Learning Plan 5/jsFiles` directory (aka folder) with the name `5.1lab1.js`.
5. Open this lab HTML file, `5.1lab1.html`, in Microsoft Visual Studio.
6. Scroll down to the JavaScript code, it's in the place we're used to it being.
7. Copy the code, and just the code, after the line `// YOUR CODE STARTS AFTER THIS LINE:`, and paste it into the file you made named `5.1lab1.js`.
8. Add this line before the code:

       function lab51_1JavaScript() {

9. Add this after the end:

       }

10. We've been indenting our code all semester to get used to where it will be when we have it in a function. The `function` line and the final `}` should be all the way over to the left. Our code will then be indented 4 spaces, just like we've been doing.
11. Now edit the lab HTML file and delete everything between the <script language="JavaScript" type="text/javascript"> line and the </script> tag. That's right, we don't need any of that //<![CDATA[ stuff anymore. And we don't need the JavaScript code either.
12. Add the function call to the lab HTML file where you just deleted all the other stuff. The function call looks like this:

            lab51_1JavaScript();

13. Refresh the lab page. Did it work? Did you still get the output?

### Lab Output: