Capítulo 6

Funções length

JavaScript

<script type="text/javascript">
	function soma (x, y) {
		alert (arguments.length) // argumentos passados 3
		return x + y;
	};
	window.onload = function() {
		alert (soma.length); // argumentos esperados 2
		}
<script>

HTML

<body>
<button type="button" onclick="alert('Soma: ' + soma(5, 4, 26))">soma(5, 4, 26)</button>
...