Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davidystephenson/169c1d0fcd6f18a4e0f71876fe1ba6a1 to your computer and use it in GitHub Desktop.
Save davidystephenson/169c1d0fcd6f18a4e0f71876fe1ba6a1 to your computer and use it in GitHub Desktop.
// 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