Client Login Register
Calculate Price & Order →
← Back to all articles

Easy code with console.log

Published on December 02, 2026 • Category: Academic
Easy code with console.log

Easy code with console.log

The introduction of this book alluded to the following as a nice way to compute the sum of a range of numbers:

console.log(sum(range(1, 10)));

Write a range function that takes two arguments, start and end, and returns an array containing all the numbers from start up to (and including) end. Send the results to the web page, not the console.

Next, write a sum function that takes an array of numbers and returns the sum of these numbers. Run your program with range 1, 10 and see whether it does indeed return 55.

Make sure you include comments on your code.

Save your code as an HTML file and upload it to this assignment.




Share

We only email you; unsubscribe in one click. No address is ever sold.

Ask about study support 💬 WhatsApp 📞

Just now