tutorial 3: introduction to programming structures--functions
watch it on YouTube
Notes
- tasks that are repeated are good candidtaes for being
coded as a function
- tasks that are a single discreet unit are good
candidates for being coded as their own function.
- parts of a function:
- name
- parameter(s)
- algorithm
- result or return value
Definitions
- function
- building block of code that can be called or
invoked, can accept input, and implicitly
or explicitly produces or returns a result.
- algorithm
- encoded steps of a specific task
JavaScript Syntax Example: Function
- function to Celcisu(farenheit) {
- var tem = (5/9) * (farenheit-32);
- var report = farenheit + " degrees F is
equal to " + temp + " degrees Celcius";
- return report;
- }