You are previewing Secrets of the JavaScript Ninja.

Secrets of the JavaScript Ninja

Cover of Secrets of the JavaScript Ninja by John Resig and Bear Bibeault Published by Manning Publications
O'Reilly logo

Chapter 3. Functions are fundamental

In this chapter we discuss

  • Why understanding functions is so crucial
  • How functions are first-class objects
  • How the browser invokes functions
  • Declaring functions
  • The secrets of how parameters are assigned
  • The context within a function

You might have been somewhat surprised, upon turning to this part of the book dedicated to JavaScript fundamentals, to see that the first topic of discussion is to be functions rather than objects.

We’ll certainly be paying plenty of attention to objects (particularly in chapter 6), but when it comes down to brass tacks, the main difference between writing JavaScript code like the average Joe (or Jill) and writing it like a JavaScript ninja is understanding JavaScript ...

The best content for your career. Discover unlimited learning on demand for around $1/day.