Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <h2>JavaScript Arrays</h2> <p>Subtract the numbers in the array, starting from the right:</p> <p id="demo"></p> <script> const numbers = [175, 50, 25]; document.getElementById("demo").innerHTML = numbers.reduceRight(myFunc); function myFunc(total, num) { return total - num; } </script> </body> </html>