2 Pages
Unlock Document

Marist College
Computer Science
CMPT 120L-115
Matthew Johnson

A Balanced Introduction to Computer Science, 3 Editiond David Reed Chapter Nine: Abstraction and Libraries A. Abstraction – the process of ignoring minutiae and focusing on the big picture 1. Functions represent units of computation from which the details are abstracted away 2. Encapsulating statements: define simple functions that augmented the predefined functions provided a. By encapsulating all the JavaScript statements to be executed when a button is clicked, a user-defined function simplifies the button and makes the page body easier to read B. The Structure of Functions 1. A function is a mapping from some number of inputs to a single output a. Parameters – variables that appear in the parentheses following the function name i. Separate by commas ii. Correspond to function’s input (1 input value has one parameter in parentheses) iii. When a function is called, the input values specified in the call are assigned to the parameter variables, which can be used in performing the computation b. Local variable declaration – declares all of the variables that will be used by the function to carry out its computation i. 1 statement inside the general form ii. variables are treated as local to the function (exist only inside that function while it’s executing) iii. without this declaration, variables are considered global, making them accessible and changeable from anywhere in the page c. storing temporary values: i. declare as local ii. separate by commas iii. follow keyword var d. return statement – optional statement that can appear at the end of a function definition i. r
More Less

Related notes for CMPT 120L-115

Log In


Don't have an account?

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.