Programming Flashcards
Callback function
a function specified as part of an event listener; it is written by the programmer but called by the system as the result of an event trigger.
Event
An action that causes something to happen.
Event-driven program
a program designed to run blocks of code or functions in response to specified events (e.g. a mouse click)
Event handling
an overarching term for the coding tasks involved in making a program respond to events by triggering functions
coding tasks involved in making your app respond to events by triggering functions
Event listener
a command that can be set up to trigger a function when a particular type of event occurs on a particular UI element.
UI Elements
on-screen objects, like buttons, images, text boxes, pull down menus, screens and so on.
User Interface
The visual elements of a program through which a user controls or communicates with the application. Often abbreviated UI.
refers to how a person (user) interacts with the computer or app.
Users trigger events
Events occur when users click a button, tap the screen, move the mouse, type a key on the keyboard, etc.
what does context sensitive mean?
properties tab is context sensitive which means that the set of properties you see depends on what you click on in the application
what is an element id?
you refer to the element in your code.
UI Elements
objects, like buttons, images, text boxes, pull down menus, screens and so on.
UI Events
controls, like click, scroll, move mouse, type keyboard key, etc.
Events trigger code
When an event occurs or “fires” it can be used to trigger a particular javascript function
debugging
writing any code and it’s an error, or didn’t work for any other reason and you dug in and figured out why and fixed it
characteristics of IDs
case sensitive
cannot contain spaces
must begin with a letter (A-Z or a-z) and may be followed by any number of digits and letter
can contain hyphens “-“, “_”, “.”, “:”
rules with variables
use “var” only once
create your variables at the top of your program
create variables outside onEvent blocks
global variables
Permanent. Can be used anywhere in your code
var used outside an onEvent
local variable
Temporary. Can be used only in the part of the code where it was created, like inside an onEvent. Deleted once the onEvent is done running.
var used inside an onEvent
what do if-else-if commands do
lets you check multiple boolean conditions
what are boolean conditions?
a conditional expression
consists of chained conditionals and nested conditionals
how will computers check if-else-if commands?
check conditions in the order they are written until one of the boolean expressions evaluates to true
code associated with that boolean expression will be run, but all others will be skipped
If none of the expressions evaluates to true then the code inside the else command will be run.
how to write if-else-if statments?
most specific cases first
chained conditionals
else/else-if
nested conditionals
if statements inside of if statements