// This example is from the book JavaScript: The Definitive Guide. // Written by Dog. // This example is provided WITHOUT WARRANTY either expressed or implied. // You may study, use, modify, and distribute it for any purpose. function f(x, y, z) { // first, check that the right # of arguments were passed. if (f.arguments.length != 3) { alert("function f called with " + f.arguments.length + "arguments, but it expects 3 arguments."); return null; } // now do the actual function... }