experiment with strings, numbers,
+ operator, and calling functions.
If your code isn't working as expected, try opening up Firefox's error console to check for (potentially) helpful error messages. If you get stuck, don't hesitate to ask the instructor or a teaching assistant for help.
Tip: Here are some handy keyboard shortcuts:
Select-All: Command-A (Mac), Control-A (Windows)
Copy: Command-C (Mac), Control-C (Windows)
Paste: Command-V (Mac), Control-V (Windows)
alertstatement in the function by removing the
//symbols at the beginning of the line. (There will still be a comment to the right of the statement, at the end of the line.) What do you think the function will do now? Save the file and preview or reload the page, then click on the "Run Experiment" button to test your understanding. Update the comment at the end of the line to show what the output was.
In the first two statements, you displayed a string and a number.
The next five statements will
let you experiment with what the
+ operator does inside
and outside strings, and when given two numbers, two strings, or a number
and a string.
For each of these statements, indicate what you think the output will be in the comment at the end of the line. Then uncomment the statements, either one-by-one or all at once, save and re-preview/reload the file, and click "Run Experiment", comparing the actual output values with the values you expected. For each value that is different from what you expected, look at it again and see if you can see why the output was the way it was. If not, ask a neighbor, instructor, or TA to explain it to you. Update the end-of-line comments if necessary, to reflect the actual output.
Edit the course "home page" you created in Lab 1 and add a link to your new mini-lab page. Since this is just the first of many links you will be adding, you may want to create a heading and a list; for example,
COMP 105 Assignments
- Link to Mini-Lab 1: Numbers and Strings
In the link, refer to your new page with a relative pathname
which is just the name of the file (e.g.,
This tells the browser that the file to look for is in the same
directory or folder as the current file (your main COMP 105 web page,
in this case).
You do not want to give
a full or absolute pathname, like
because the location of your file on the
peopleftp.kzoo.edu server will not be the same as on
your own laptop or classroom computer.
If you worked in a team, each member of your group should do this, so each of you has a link to the new mini-lab page.
people.kzoo.eduserver (remember that its host name for uploading is
peopleftp.kzoo.edu). Test that the link to the Mini-Lab works on the server by clicking on it from your home page.