Created
May 28, 2021 17:35
-
-
Save appoll/ab25190977913bf6eb5017a156899da0 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
ages = [12, 16, 24, 98, 64, 24, 98, 64, 24, 98, 64] | |
// Print all the ages in your array :) | |
// We use the for loop | |
for (let i = 0; i < ages.length; i = i + 1){ | |
let currentAge = ages[i]; | |
console.log("Position is: " + i); | |
console.log("Value is: " + currentAge); | |
} | |
// E0. Print all the ages in the array in reverse order; | |
for (let i = 0; i < ages.length; i = i + 1){ | |
} | |
// E1. Print all positions of all ages greater than 18; | |
// E2. Iterate through the array and calculate the sum of its values; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment