Exercise · Array methods · lesson 9 of 12
Exercise: sum of even squares
Write a function function sumEvenSquares(nums) that returns the sum of the squares of the even numbers in the array nums.
sumEvenSquares([1, 2, 3, 4])→20sumEvenSquares([1, 3, 5])→0sumEvenSquares([-3, -2])→4
Constraints: nums holds 0 to 10 integers from -100 to 100; negative numbers and 0 can be even too; for an empty array and an array with no even numbers the result is 0.
Do not add extra imports unless the task says so explicitly.
Subscribe to take the course
The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.