Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

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

9. Code Organization > Code Structure

Code Structure

By now you know that code blocks get wrapped into functions. We have explored beyond that of a normal function and onto types like anonymous functions and nesting functions inside objects to create the elusive JavaScript method. The function alone can take many different versions, and deciding which one to use can greatly affect your application and how it performs.

In this section we are going to take a look the pizzaParty() function and how it would look if we were to transform it into all the different function types. We’ll also talk about when it might be a good time to use one over the other.

Functions

The normal function call is something we have not only been using in this chapter, but throughout the entirety of the book to this point.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint