Give Me the Even Numbers

Published by Matt in

Create a function that takes two parameters (start, stop), and returns the sum of all even numbers in the range.

Examples

sumEvenNumsInRange(10, 20) ➞ 90
// 10, 12, 14, 16, 18, 20

sumEvenNumsInRange(51, 150) ➞ 5050

sumEvenNumsInRange(63, 97) ➞ 1360

Notes

Remember that the start and stop values are inclusive.

Watch a quick demo on how Edabit works.