Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Chapter 7
Function Expressions
WHAT’S IN THIS CHAPTER?
One of the more powerful, and often confusing, parts of JavaScript is function expressions. As mentioned in Chapter 5, there are two ways to define a function: by function declaration and by function expression. The first, function declaration, has the following form:
function functionName(arg0, arg1, arg2) {
//function body
}
The name of the function follows the function keyword, and this is how the function’s name is assigned. Firefox, Safari, Chrome, and Opera all feature a nonstandard name property on functions exposing the assigned name. This value is always equivalent to the identifier that immediately follows the function keyword: