title: Strict-Mode: Alternative to argument.callee.length?
body: <p>Javascript: The Definitive Guide (2011) has this example (p.186) that doesn't work in strict mode but does not show how to implement it in strict mode--I can think of things to try but am wondering about best practices/security/performance--what's the best way to do this sort of thing in strict mode?  Here's the code:</p>
  
  <pre><code>// This function uses arguments.callee, so it won't work in strict mode.
  function check(args) {
      var actual = args.length;          // The actual number of arguments
      var expected = args.callee.length; // The expected number of arguments
      if (actual !== expected)           // Throw an exception if they differ.
          throw Error("Expected " + expected + "args; got " + actual);
  }
  
  function f(x, y, z) {
      check(arguments);  // Check that the actual # of args matches expected #.
      return x + y + z;  // Now do the rest of the function normally.
  }
  </code></pre>