Skip to content

Commit

Permalink
passes all the second testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
ii2Chris committed Aug 11, 2024
1 parent 29eaef2 commit 0c0639c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions session-02/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ function transformArrayToUpper(listOfStrings) {
const uppercaseStrings = [];

// iterate through the inital array, and convert every element to uppercase
for (const index in listOfStrings){
uppercaseStrings.push(listOfStrings[index].toUpperCase());
for (const index of listOfStrings){
uppercaseStrings.push(index.toUpperCase());
}

// return the converted array
Expand All @@ -29,9 +29,8 @@ function sumOfAllAges(listOfStudentObjects) {
let totalAge = 0;

//for every entry, add that age to the total age;
for (const index in listOfStudentObjects){
const student = listOfStudentObjects[index];
totalAge += student.age;
for (const index of listOfStudentObjects){
if (index.age) totalAge += index.age;
}

//Return the total age
Expand Down

0 comments on commit 0c0639c

Please sign in to comment.