Created
November 21, 2022 18:38
-
-
Save appoll/10d866b7f8653440b50dc57eaca714f8 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] | |
// E0. Print all the ages in the array in reverse order; | |
for (let i = 0; i < ages.length; i = i + 1){ | |
console.log(ages[i]); | |
} | |
// E1. Print all positions of all ages greater than 18; | |
for (let i = 0; i < ages.length; i = i + 1){ | |
console.log(ages[i]); | |
} | |
// E2. Count how many ages in the array are greater than 18; | |
// Hint: an extra variable | |
for (let i = 0; i < ages.length; i = i + 1){ | |
console.log(ages[i]); | |
} | |
// E3. Iterate through the array and calculate the sum of its values; | |
// Hint: an extra variable | |
for (let i = 0; i < ages.length; i = i + 1){ | |
console.log(ages[i]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment