2-js-basics/4-arrays-loops/assignment.md
Complete the following exercises to practice working with arrays and loops. Each exercise builds on concepts from the lesson and encourages you to apply different loop types and array methods.
Create a program that lists every 3rd number between 1-20 and prints it to the console.
Requirements:
for loop with a custom incrementExpected Output:
3, 6, 9, 12, 15, 18
Tip: Modify the iteration-expression in your for loop to skip numbers.
Create an array of at least 8 different numbers and write functions to analyze the data.
Requirements:
numbers with at least 8 valuesfindMaximum() that returns the highest numberfindMinimum() that returns the lowest numbercalculateSum() that returns the total of all numbersBonus Challenge: Create a function that finds the second highest number in the array.
Create an array of your favorite movies/books/songs and practice different loop types.
Requirements:
for loop to display items with numbers (1. Item Name)for...of loop to display items in uppercaseforEach() method to count and display the total charactersExample Output:
Traditional for loop:
1. The Matrix
2. Inception
3. Interstellar
For...of loop (uppercase):
THE MATRIX
INCEPTION
INTERSTELLAR
Character count:
Total characters across all titles: 42
Create a program that processes an array of objects representing students.
Requirements:
name, age, gradeExample Structure:
const students = [
{ name: "Alice", age: 17, grade: 92 },
{ name: "Bob", age: 18, grade: 84 },
// Add more students...
];
Test your programs by:
Include the following in your submission:
| Criteria | Exemplary (3 points) | Adequate (2 points) | Needs Improvement (1 point) |
|---|---|---|---|
| Functionality | All exercises completed correctly with bonus challenges | All required exercises work correctly | Some exercises incomplete or contain errors |
| Code Quality | Clean, well-organized code with descriptive variable names | Code works but could be cleaner | Code is messy or hard to understand |
| Comments | Comprehensive comments explaining logic and decisions | Basic comments present | Minimal or no comments |
| Loop Usage | Demonstrates understanding of different loop types appropriately | Uses loops correctly but limited variety | Incorrect or inefficient loop usage |
| Testing | Evidence of thorough testing with multiple scenarios | Basic testing demonstrated | Little evidence of testing |
After completing the exercises, consider: