Review JavaScript Fundamentals by Building a Gradebook App - Step 2

Tell us what’s happening:

  1. Почему я должен использовать “score” в каждом условии.
  2. Почему не будет работать код…
    “let message;”
    и вставлять “message” вместо “return”
    в конце тела цикла " score += message;"
  3. Мы изучали “&&” ? я не помню что мы его практиковали.
    P.S. Решение я видел в других темах. Я хочу понять! как это строится.
    Спасибо за терпение!

Your code so far

function getAverage(scores) {
  let sum = 0;

  for (const score of scores) {
    sum += score;
  }

  return sum / scores.length;

// User Editable Region

}

function getGrade(score) {
if(score === 100){
  return  "A++";
}else if(90 >= 99){
  return  "A";
}else if(80 >= 89){
  return  "B";
}else if(70 >= 79){
  return  "C";
}else if(60 >= 69){
  return  "D";
}else{
  return  "F";
}
}
console.log(getGrade(96));
console.log(getGrade(82));
console.log(getGrade(56));

// User Editable Region

Your browser information:

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

Challenge Information:

Review JavaScript Fundamentals by Building a Gradebook App - Step 2

your question doesn’t seem related to step 2, do you have a question for step 2?

Да, код выводит “F” в трех вариантах почему?

all your options are false, because 90 >= 99 is false as 90 is not higher than 99. You want to compare score with a number instead

hey im stuck step 3

The p element is used to create a paragraph of text on websites. Create a p element below your h2 element and give it the following text:

Everyone loves cute cats online!

hi @talicudfs please create your own topic

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Help button located on the challenge. This button only appears if you have tried to submit an answer at least three times.

The Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

1 Like