Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1170 How can I tell how many arguments have been passed to a function, and what data type the arguments are?

You are here: irt.org | FAQ | JavaScript | Function | Q1170 [ previous next ]

Try:

<script language="JavaScript"><!--
function myFunctionName() {
    var o = '';
    o += 'Number of arguments = ' + arguments.length + '\n';
    for (var i=0;i < arguments.length; i++)
        o += 'Argument ' + i + ' typeof = ' + typeof arguments[i] + '\n';
    alert(o);
}

myFunctionName(123,'xyz',new Object());
//--></script>

©2018 Martin Webb