But did you know that there are other ways to do the same thing? Here's one way:
mySocks = function(p1) {
document.write("I own a grand total of " + p1 + " socks.");
}
You'd call that function just like one you'd declared in the traditional way:
mySocks("three");
The third way of declaring a function is with the Function object, whose function is to define functions:
myTeeth = new Function("p1", "document.write('I have ' + p1 + ' remaining teeth.');");
When defining a Function object, the parameters come first (you can have as many of them as you want). The last quoted string is the function body itself, with statements separated by semicolons.
How useful is this technique? Not terribly, as it eliminates the modular
aspects of functions -- one of their greatest attractions, after all.
Still, these are alternatives you might need someday.