Saved X
Google login
SignUp with Email
X

Multiply all numbers in an array javascript

theindreshverma ( Edited  Sep 30, 12:40 am )
Login

Javascript array with for loop

<script>
function multiply(array) {
    var total = 1;
    for (var i = 0; i < array.length; i++) {
        total = total * array[i];
    }
    return 'Total '+total;
}

document.write(multiply([10, 8, 6, 5]));
</script>

</body>
</html>

Sourcecode Tags

More Sourcecodes

More Sourcecodes