In the stage 4 of the building a gradebook app, I don’t know what to do
please share your code
function studentMsg(totalScores, studentScore) {
return “Class average:” + " "+getAverage(totalScores) + “.” + " "+ “Your grade:” + " " + getGrade(studentScore) + “.” + " "
}
My challenge is that I don’t know whether I need to add a new function for the last string for stating whether a student failed or not.
you have a function hasPassingGrade
that you can use. You need the last part of the message to be one way or the other depending if the student passed or not
Here is the code I used
function studentMsg(totalScores, studentScore) {
return "Class average:" + " "+getAverage(totalScores) + "." + " "+ "Your grade:" + " " + getGrade(studentScore) + "." + " " + display()
}
function display(){
if(hasPassingGrade === "F"){
return "You passed the course."
}
else{
return "You failed the course.";
}
}
but I am certainly getting something wrong, can you put me through
hasPassingGrade
is a function, you need to call it and pass it a value. What value are you checking?
I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>
) to add backticks around text.
See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').
function display(studentScore){
if(hasPassingGrade(studentScore) === "F"){
return "You failed the course."
}
else{
return "You passed the course.";
}
}
I passed the studentScore argument into the function, it doesn’t w
Hi there!
Your returning strings are incomplete. That’s only return the words, isn’t the average and grade in output.
Hello, I didn’t really get your explanation
Re-read the challenge instructions carefully. You have missing important things from instructions in your code.
And for explanation first tell me, what you didn’t understand from instructions.
A post was split to a new topic: Building a gradebook app step 4
Hi there and welcome to the forum!
Posting solution code is not allowed here on the forum. Instead, you can help by given suggestions and hints about the code.