Build a Gradebook App - Build a Gradebook App

Tell us what’s happening:

I do some console test with different numbers and work fine, but the point 17. and 22. dont pass and i dont know why

  1. Your hasPassingGrade function should return false if the grade is an
    “F”

. 22. Your studentMsg function should return the correct message based on the student’s score and the class average.

Your code so far

function getAverage (testScores) {
  let average = 0;
  for(let char of testScores) {
    average += char;
  }
  return average / testScores.length;
}

function getGrade (score) {
  if(score <= 59) {
    return "F";
  } else if(score <= 69) {
    return "D";
  } else if(score <= 79) {
    return "C";
  } else if(score <= 89) {
    return "B";
  } else if(score <= 99) {
    return "A";
  } else {
    return "A+"; 
  }
}

function hasPassingGrade (grade) {
  return grade !== "F"
  }

function studentMsg(testScores, studentScore) {
  let average = getAverage(testScores);
  let grade = getGrade(studentScore);

  if (hasPassingGrade(grade)) {
        return `Class average: ${average.toFixed(1)}. Your grade: ${grade}. You passed the course.`;
  } else {
        return `Class average: ${average.toFixed(1)}. Your grade: ${grade}. You failed the course.`;
  }
}
console.log(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37));
console.log(studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100));

Your browser information:

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

Challenge Information:

Build a Gradebook App - Build a Gradebook App

Why the extra space before the ( here? (and in your other functions?)

You should have a function named hasPassingGrade that takes a score as a parameter

Are you taking score as a parameter?

Where did the instructions ask for all of what you’re doing here?

the extra spaces is a personal problem lol.
in my lesson I dont have that instruction, I have :

    1. You should have a function named hasPassingGrade.
  • Passed:15. Your hasPassingGrade function should return a boolean value.

  • Passed:16. Your hasPassingGrade function should return true if the grade is an "A".

  • Failed:17. Your hasPassingGrade function should return false if the grade is an "F".

  • Passed:18. Your hasPassingGrade function should return true for all passing grades.

for the last question i put it to ensure the average is displayed with one decimal place, which matches the expected output format.

I quit the extra spaces and delete the .toFixed but still have the same errors

The User Stories section did not appear on your browser? That is a massive bug

I don’t know what “extra spaces” you mean, but you definitely should not be using toFixed()

sorry, the test .22 pass. Thank u sr, Im going to see the score parameter on the hasPassingGrade function

I think I dont have The User Stories section

This is not what the project looks like for you?

Thats exactly what I see

Then you have a User Stories section. It’s there is the screenshot.

Nice, i didnt knew that its call like that. But i dont have the step that u tell me of Score parameter, I only ve those that iput u before

Look at 2 under the words User Stories

1 Like