Build a Gradebook App - Build a Gradebook App

Tell us what’s happening:

I got all the functions working and I’m getting the correct output for each example, but I am not passing the last five steps of the project. Would someone take a look and give me some guidance please?

Your code so far

const student = ("");

function getAverage(scores) {
  const initialValue = 0;
const sumWithInitial = scores.reduce(
  (accumulator, currentValue) => accumulator + currentValue,
  initialValue,
);
return sumWithInitial/scores.length;
}
getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]);

function getGrade(score) {
  let grade = "";
  if (score === 100) {
    return grade = "A+";
  } else if (score >= 90) {
    return grade = "A";
  } else if (score >= 80) {
    return grade = "B";
  } else if (score >= 70) {
    return grade = "C";
  } else if (score >= 60) {
    return grade = "D";
  } else if (score < 60) {
    return  grade = "F";}
  
  }

getGrade(100);

function hasPassingGrade(grade) {
  if (getGrade(grade) === "F") {
    return false;
  } else {
    return true;
  }
}

function studentMsg(scores, grade) {
  getAverage(scores);
  if (hasPassingGrade(grade)) { 
    return console.log("Class average: "+ getAverage(scores) +". Your grade: "+ getGrade(grade)+". You passed the course.")
  } else if (!hasPassingGrade(grade)) {
    return console.log("Class average: "+ getAverage(scores)+". Your grade: "+getGrade(grade)+". You failed the course.")
  }
}
studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 76)
studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100)
studentMsg([12, 22, 32, 42, 52, 62, 72, 92], 85)
studentMsg([15, 25, 35, 45, 55, 60, 70, 60], 75)

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36

Challenge Information:

Build a Gradebook App - Build a Gradebook App

double check what is this doing?

I don’t know why I included a return statement there. I removed the returns from the console.log statements. But I’m still not passing the tests.

Here are some debugging steps you can follow. Focus on one test at a time:

  1. Are there any errors or messages in the console?
  2. What is the requirement of the first failing test?
  3. Check the related User Story and ensure it’s followed precisely.
  4. What line of code implements this?
  5. What is the result of the code and does it match the requirement? (Write the value of a variable to the console at that point in the code if needed.)

If this does not help you solve the problem, please reply with answers to these questions.

what are you asked to do tho? return something or log something?

I re-read the user stories and replaced the return console.log statements with just return statements. The project finally passed! Thanks for all the help.