Home > Web Front-end > JS Tutorial > js中函数function length属性详解

js中函数function length属性详解

WBOY
Release: 2016-06-01 09:55:02
Original
2149 people have browsed it

相信大家对js中的字符串和数组的length都比较了解,但是js中函数function也有length属性,该属性表示定义函数的参数个数,与arguments不同,arguments表示实际接受的参数。
看下面实例:

<code><script type="text/javascript">
function sumfun(sum1,sum2,sum3,sum4) {
    return sum1+sum2+sum3+sum4;
}
alert(sumfun.length); //运行结果:4
</script></code>
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template