Arguments Overview

[Total: 0    Average: 0/5]

Arguments[] is an array of function arguments 😉

Body Code:

 <script type=text/javascript>
function doIt() {
  var c=0;
  for (var i in arguments) {
    document.write("Arg "+(c++)+" is "+i+"<BR>");
  }
  c=0;
  for (var i=0; i < arguments.length; i++) {
    document.write("Arg "+(c++)+" is "+arguments[i]+"<BR>");
  }
  c=0;
  for (var i=arguments.length-1; i >= 0; i--) {
    document.write("Arg "+(c++)+" is "+arguments[i]+"<BR>");
  }
  document.write("Called by: "+arguments.caller+"<BR>");
  document.write("I am: "+arguments.callee+"<BR>");
}
function ok() { doIt("one","two","three");}
ok("how");
</script>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *