IFSC 3300      HW1           Due by Wednesday Aug. 31, 2022

Directions: Answer the questions below, then hand in by emailing to IFSC3300HW@gmail.com. Put answers along with each question in body of email. Attachments are less preferred. Avoid sharing a google doc because the grader might not be able to see it.

 

1.      Go to w3schools.com, then to its JS Tutorial section, then to the first lesson there, linked from "JS HOME" and titled (once you get there) "JavaScript Tutorial." Find the sandbox on that page and go to it by clicking "Try it Yourself."

·       Explain the button HTML command, except for the JavaScript code part.

·       Explain the meaning of onclick, which is an argument to the button command.

·       Explain the JavaScript code assigned to the onclick argument.

·       What does "demo" refer to?

·       What does the function getElementById() do?

·       What does innerHTML refer to?

·       What does the function Date() do?

2.      Consider the "JavaScript Where To" lesson, linked from "JS Where To." JavaScript may be placed within HTML <script>…</script> tags. Let us call these code passages "scripts." Can a script be placed in an HTML head, body, neither, or both?

3.      Consider external JavaScript code.

a.      Why might code be placed in an external file instead of in a web page?

b.      Find the external code file myScript.js on the W3schools site. What is the URL of that file?

4.      Consider the "JavaScript Output" lesson linked from "JS Output."

a.      Write an HTML page (you can use a sandbox from "JS HOME" or elsewhere) that has 4 buttons on it. One button demonstrates output to the innerHTML location of an HTML element. Another button demonstrates (when you click it) the document.write() output method. A third button demonstrates output using the alert() function. And a final button calls window.print().
< < < <  Hand in the code by pasting it into the body of your email.

b.      Consider output using console.log(). Explain what you see in the console, or provide a screen shot of the console containing a logged output.

5.      Consider the "JavaScript Statements" lesson.

a.      What is the minimum number of statements in a code block, that is, the stuff typically between curly braces, as in, {your code here}?

b.      Guestimate the maximum number of statements in a code block.

c.       T or F: The semicolon (";") is a statement separator in JS.

d.      What is the difference between a statement separator and a statement terminator?

e.      In English, is the question mark typically a statement separator or a statement terminator?

6.      (Optional) Was this HW too hard? Too easy? About right? Did it take too long? Not long enough? About the right amount of time? What other comments do you have? Thanks!