Fungsi JavaScript untuk melipatgandakan satu set angka

function multiply(...myArray) {
    let result = 1;
    for (let i = 0; i < myArray.length; ++i) { 
      result *= myArray[i]; 
    }
    console.log("The product is: " + result); 
}

// For example,
// multiply(1,2,3,4);
// => 24

// The '...' is a rest operator that converts 
// any parameter in the function to an array

// Here is a shorter way of doing the same thing.
function multiply(...myArray) {
    let result = 1;
    myArray.forEach(e => {
        result *= e;
    });
    console.log("The product is: " + result); 
}
Code Rabbi