English feliratok

← Independent Research Solution - JavaScript Basics

Beágyazókód kérése
4 Languages

Showing Revision 3 created 05/25/2016 by Udacity Robot.

  1. So, taking a look at this snippet of code,
  2. it looks like $(document).click() is taking in some kind of function.
  3. We see function, then a parameter, and
  4. then these curly braces that are passing in, well, some instructions.
  5. This is similar to regular function syntax,
  6. where we declare a function with the keyword function, set some parameters, and
  7. then put code inside curly braces.
  8. But this function doesn't seem to have a name.
  9. And that's kind of curious.
  10. So let's go ahead and open up Google.
  11. I typed in JavaScript function without name and
  12. I'm going to take a look at the results.
  13. We came across an article about JavaScript Anonymous Functions.
  14. This seems really useful.
  15. It looks like an anonymous function is one that's declared without a name.
  16. That sounds like what we've got.
  17. So it looks like $(document).click is taking an anonymous function as
  18. a parameter.
  19. You'll find anonymous functions all over the place in JavaScript.
  20. So I encourage you to check out the resources in the Instructor Notes to learn
  21. more about them.