topical media & game development

talk show tell print

professional-javascript-14-DebugExample4.htm / htm

          <title>Debug Example</title>
          <script type="text/javascript">
                  function divide(iNum1, iNum2) {
                      if (arguments.length != 2) {
                          throw new Error("divide() requires two arguments.");
                      } else if (typeof iNum1 != "number" || typeof iNum2 != "number") {
                          throw new Error("divide() requires two numbers for arguments.");
                      return iNum1.valueOf() / iNum2.valueOf();
          <p>This page throws a custom JavaScript error.</p>

(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.