Review JavaScript Fundamentals by Building a Gradebook App - Step 2

Tell us what’s happening:

Hi there

can someone please tell what I am doing wrong
sorry for all the questions

Thanks
Iskren

Your code so far

function getAverage(scores) {
  let sum = 0;

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

  return sum / scores.length;
}

// User Editable Region



if (grade===100){
  console.log("A++");
} else if (score >=90 && score <=99){
  console.log("A");
} else if (score >=80 && score <=89){
  console.log("B"); 
} else if (score >=70 && score <=79){
  console.log("C");
} else if (score >=60 && score <=69){
  console.log("D");
} else (score >=0 && score <=59){
  console.log("F");
}

const grade = 96;
console.log(grade);

function calcAve(grade) {
  return getGrade;
}

console.log(getGrade(96));
console.log(getGrade(82));
console.log(getGrade(56));

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Safari/605.1.15

Challenge Information:

Review JavaScript Fundamentals by Building a Gradebook App - Step 2

use return instead of console log in your if statements

thats not it, I put return grade in the function and not working

i am talking about this, instead of console.log (“A”) try return “A”

change or remove this too you already have all the console log you need below

doesn’t work, I think it has something to do with the function

Your if else statements are supposed to be in the getGrade function, let me know what happens

im getting closer, how do I delete this post and post my updated one

It says Your getGrade function should return "A++" if the score is 100 .

I put:
if (grade===100){

Tell us what’s happening:

Hi there

Can someone please tell me what I am missing in this question?

Thanks
Iskren

Your code so far

function getAverage(scores) {
  let sum = 0;

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

  return sum / scores.length;
}

// User Editable Region





const grade=100;
console.log(grade);


function getGrade(score) {
  if (grade===100){
  return "A++";
} else if (score >=90 && score <=99){
  return "A";
} else if (score >=80 && score <=89){
  return "B";
} else if (score >=70 && score <=79){
  return "C";
} else if (score >=60 && score <=69){
  return "D";
} else (score >=0 && score <=59)
  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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Safari/605.1.15

Challenge Information:

Review JavaScript Fundamentals by Building a Gradebook App - Step 2

(grade===100)

Change grade to score. You are taking in the score via the function call. Your grade variable is unnecesary.

bingo, thanks alot :slight_smile:

1 Like

Please share your updated code.

Why not update this one?

Hi there @iskren500 !

Click the Preformatted text option in reply settings option, it will insert back ticks automatically in reply. Then between the pair of three back ticks, separately copy and paste your code.
Example:
(```)

Your code here

(```)

forget that braces I added around back ticks.

you don’t have a getGrade function