programming with javaScript
- element, attribute, or text from an HTML page
- add elements, attributes, and text to the page, or remove them
- specify a set of steps for the browser to follow
- when a specific event has occurred you can script an action in respones
-
- break goal into steps
- use flow charting to identify gates
- expressions evaluate into a single value
-
variabes need values, values can come from 1 or more elements
-
strings operator is only +
Functions
- Functions let you group a series of statements together to perform a specific task
- function are not always executed or more statements contained example on the right; you will when a page loads
- a func can be called when needed in other parts of the code
- funcs can return info to the code that called them vie the return command
- returning multiple values
function getSize (width, height, depth) { var area = width * height; } var volume = width * height * depth; var sizes= [area , volume]; return sizes; var areaOne = getSize (3, 2, 3)[0]; var volumeOne = getSize (3, 2, 3)[1];
*Back