• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

7.2. Debugging

When working with functions there are some simple syntax rules to watch for.

  1. Did you use parentheses after the function name?

  2. Did you use opening and closing curly braces to hold the function definition?

  3. Did you define the function before you called it? Try using the typeof operator to see if a function has been defined.

  4. Did you give the function a unique name?

  5. When you called the function is your argument list separated by commas? If you don't have an argument list, did you forget to include the parentheses?

  6. Do the number of arguments equal the number of parameters?

  7. Is the function supposed to return a value? Did you remember to provide a variable or a place in the expression to hold the returned value?

  8. Did you define and call the function from within a JavaScript program?


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint