Lect14Functions - Announcements You must implement...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Announcements You must implement programming projects by yourself 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Introduction to Functions Function An entity that completes a particular task for us It can take values necessary to complete a particular task After completing a task it returns to the point after the call Examples of JavaScript functions document.writeln alert() You can define your own functions. Order of declaration is immaterial Example: Functions.html
Background image of page 2
3 Introduction to Functions General form of a function is: function name (<comma-separated list of parameters>) { statements } Functions are invoked (called) by using the () operator A function can receive values via parameters We don’t use var for parameters A function may return a value There are other approaches to define functions
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Scope of Variables Variables declared in a function are called local variables They are created on entry to the function and destroy on exit You can use the same name in different functions as they are different variables Variables declared outside of a function are called global variables
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/04/2010 for the course CMSC cmsc122 taught by Professor Perez during the Fall '10 term at University of Maryland Baltimore.

Page1 / 9

Lect14Functions - Announcements You must implement...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online