Copyright © tutorialspoint.com
This method returns the size of the enumeration.
Iterator.size(); |
<html>
<head>
<title>Prototype examples</title>
<script type="text/javascript"
src="/javascript/prototype.js">
</script>
<script>
function showResult(){
var arr = $R(1, 10).select(function(n) { return 0 == n % 2; });
alert("Test 1 : " + $R(1, 10).size() );
// Returns 10
alert("Test 2 : " + ['hello', 42, true].size() );
// Returns 3
alert("Test 3 : " + $H().size() );
// Returns 0
}
</script>
</head>
<body>
<p>Click the button to see the result.</p>
<br />
<br />
<input type="button" value="Result" onclick="showResult();"/>
</body>
</html>
|
To understand it in better way you can Try it yourself.
Copyright © tutorialspoint.com