Creating Subfolders

Now that we have the Been There main folder, we need to add the “Europe” folder. Here's the line of code that both creates a Europe folder and adds that folder to the Been There folder:

aux1 = insFld(foldersTree, gFld("Europe",
    "http://www.geocities.com/marcelino_martins/
    ftexample/beenthere_europe.gif"))

Whoa, Nelly! What is this? It might be easier to read like this:

aux1 = insFld(foldersTree, gFld("Europe", "europe.gif"))

Nicer, eh? Now it's easier to see that there are two function calls in this short line. First we create a folder called “Europe,” but we don't make it equal to anything. Instead we immediately pass that folder to a new function called insFld. Here's another way to look at it:

 aux1 = insFld(foldersTree, ...

Get Advanced JavaScript™: Insights and Innovative Techniques now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.