Created
May 17, 2025 16:58
-
-
Save davidystephenson/169c1d0fcd6f18a4e0f71876fe1ba6a1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 3. Write a program that iterates through each number of an array using for..of loop and computes the sum of squares of each of these numbers. | |
var result = 0 | |
var numbers = [1, 2, 3] | |
for (var number of numbers) { | |
var square = number * number | |
console.log(square) | |
result += square | |
console.log(result) | |
} | |
console.log(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment