<html>
<body>
<h2>JavaScript Arrays</h2>
<p>Compute the result from subtracting the numbers in the array right-to-left.</p>
<p id="demo"></p>
<script>
const numbers = [2, 45, 30, 100];
document.getElementById("demo").innerHTML = numbers.reduceRight(getSum);
function getSum(total, num) {
return total - num;
}
</script>
</body>
</html>