<!DOCTYPE html>
<html>
<body>
<p>Sum of all arguments:</p>
<p id="demo"></p>
<script>
function sumAll() {
var i, sum = 0;
for(i = 0; i < arguments.length; i++) {
sum += arguments[i];
}
return sum;
}
document.getElementById("demo").innerHTML =
sumAll(1, 123, 500, 115, 44, 88);
</script>
</body>
</html>
<html>
<body>
<p>Sum of all arguments:</p>
<p id="demo"></p>
<script>
function sumAll() {
var i, sum = 0;
for(i = 0; i < arguments.length; i++) {
sum += arguments[i];
}
return sum;
}
document.getElementById("demo").innerHTML =
sumAll(1, 123, 500, 115, 44, 88);
</script>
</body>
</html>
Yorumlar
Yorum Gönder