A key part of the art of writing good software lies in understanding the interface between the user and the program, knowing what each is capable of doing. As the following diagram shows, many programs involve a continuing feedback loop in which the user does things in response to seeing or hearing some output from the program. This is particularly true of games of course.
Throughout Part 1 we used HTML to create the user interface in all the examples. In this page we will refer to the diagram above in order to summarise what the user, and more importantly the JavaScript program, can do with the HTML page. (In a real program there should also be some CSS, Cascading Style Sheets, determining the appearance of things in the HTML page but the present course does not go into that.)
The user can use hands to type on a keyboard or to control a mouse, stylus, touch screen or other pointing device. These all create "events" which the program can respond to, as we will describe.
Notice that the diagram has "mouth" and "speak" in parentheses because if you go to the relevant part of Mozilla's JavaScript reference site you will see that these are still experimental techniques as far as JavaScript is concerned. People are working on it though.
The user generally performs those actions in response to what the program displays, or perhaps to sounds it makes.