# JavaScript and browser behaviour

> A browser occurrence such as a click, input or key press.

Course: [Web development foundations](https://studybrix.com/en/courses/web-development/index.md)
Level: university
Prerequisites: Basic computer literacy.

## Notes

### Event

A browser occurrence such as a click, input or key press.

### DOM

The object representation of a document that scripts can inspect and change.

### State

Data representing the current condition of an interface.

### Validation

Checking input against expected rules before using it.

## Practice questions

### 1. Which term best matches this description: A browser occurrence such as a click, input or key press.

A. DOM
B. Validation
C. State
D. Event

Answer: Event

Explanation: Event is the matching concept in this lesson.

### 2. Which term best matches this description: The object representation of a document that scripts can inspect and change.

A. Validation
B. Event
C. DOM
D. State

Answer: DOM

Explanation: DOM is the matching concept in this lesson.

### 3. Which concept would you apply first in a situation where data representing the current condition of an interface.

A. DOM
B. State
C. Event
D. Validation

Answer: State

Explanation: The scenario directly calls for State.

### 4. Name the concept described as: Checking input against expected rules before using it.

Answer: Validation

Explanation: The intended concept is Validation.

### 5. Which statement about Event is most accurate?

A. A browser occurrence such as a click, input or key press.
B. The object representation of a document that scripts can inspect and change.
C. Checking input against expected rules before using it.
D. Data representing the current condition of an interface.

Answer: A browser occurrence such as a click, input or key press.

Explanation: The definition in the lesson notes gives the required condition.

### 6. Explain one important difference between Event and DOM.

Sample answer / marking guidance: Event: A browser occurrence such as a click, input or key press. DOM: The object representation of a document that scripts can inspect and change.

Explanation: Credit a clear distinction using both definitions and an appropriate example if supplied.

### 7. Give a short example showing how State would be used in practice.

Sample answer / marking guidance: A valid example should demonstrate this idea: Data representing the current condition of an interface.

Explanation: Credit a relevant scenario that applies the concept rather than merely naming it.

### 8. Summarize why Validation matters in the lesson “JavaScript and browser behaviour”.

Sample answer / marking guidance: Validation matters because Checking input against expected rules before using it.

Explanation: Credit the core purpose, scope and any important limitation from the notes.

## Further reading

- https://developer.mozilla.org/

Original AI-assisted educational draft; not independently teacher-reviewed. References support further study, not copied exercises, affiliation or curriculum accreditation.
