February 2015
Intermediate to advanced
634 pages
13h 29m
English
JavaScript functions provide a way to encapsulate a block of code in order to reuse the code several times. They are first-class objects in JavaScript, which means they can be treated as an object, as well as an expression or statement.
There are three basic ways to create a function:
function keyword; declarative functions are parsed when the JavaScript application is first loaded.
new operator and referencing the Function object. It’s anonymous because it isn’t given a name, and access to the function occurs through a variable or another object property. Unlike the declarative function, an anonymous function is parsed each time it’s accessed.
You’re not sure where to place your function to ensure it’s accessible when needed.
If you’re using a declarative function, you can place the function anywhere in the code. However, if you’re using a function ...
Read now
Unlock full access