WorksheetsCH01-TEST-OpenR-GettingYourFeetWet
Total questions: 8
Worksheet time: 24mins
Explain the difference between how you write an HTML tag (like <h1>) and how you write a JavaScript statement. Why does the document refer to HTML/CSS as "declarative" and JavaScript as requiring you to describe "computation"?
The document claims that JavaScript gives you the ability to "react to interesting events." Describe a common event on a website (like clicking a button or hovering over an image) and explain, in theory, how JavaScript would "react" to it.
Imagine the World Wide Web suddenly lost all JavaScript support. How would the user experience change on popular sites like a map application or an online store? Use concepts like "static" vs. "interactive" to support your answer.
Explain the crucial difference between declaring a variable with let and declaring a constant with const. Provide an example of a value you would store as a let (and explain why it might change) and a value you would store as a const (and explain why it should never change).
What does it mean that JavaScript is a case-sensitive language? Provide an example of two variables that look similar but would be treated as completely different by the JavaScript interpreter, and explain the problem this could cause a new programmer.
The document mentions "camel case" as the preferred naming convention. Explain what camel case is and why using descriptive, multi-word names (like userTotalScore) is better practice than using short, single-letter names (like s) in professional code.
Scenario: A student is running the following code, but the browser gives an error saying
Uncaught SyntaxError: Invalid or unexpected token:
Question: Find two errors in the variable declarations above. For each error, state the rule that was broken and suggest the correct way to declare the variable.
Scenario: The following code runs without an error but gives an unexpected output:
Question: Explain why the console still shows the original value of 10. Which rule of JavaScript syntax did the programmer forget, and how should they fix the code to make the score update correctly?
