JSFiddle - React, Tailwind, and code Playground
by Tim Morgan
HTML
<div></div>
JavaScript
// Fill in the code so multiply takes an array of numbers and returns multiplying them all together
function multiply(arr) {
var result = 1;
for(var i = 0; i < arr.length; i++) {
result = result * arr[i];
}
return result;
}
function mulTwoByFour() {
return multiply([2,4]);
}
alert(mulTwoByFour());
console.log( multiply([1,2,-1,4,5,6,67,8,9]) );
console.log( multiply([1,2]) );
console.log( multiply([+(prompt("Hey enter something")), +(prompt("enter another number"))]) );