Global Variables or Parameter Passing?
You can pass values back and forth between head and body. Global variables declared outside functions can hold variables for use anywhere, while a variable declared in a function is local to the function. But even though you can use global variables to pass a value to a function, passing parameters to the function argument is often better JavaScript. Why waste variable space when you can just put a few comma-separated values—e.g., doIt('green', 34)—into the argument as you call the function, and these values get put into local function variables in the function in the <head> section-e.g., doit(color, width).