Bug report: step 4 - Review JS fundamentals by building a gradebook app

Base user highlighted code for step 4:

function studentMsg(totalScores, studentScore) {

}
console.log(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37));

Console:

// running tests
1. studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37) should return the following message: "Class average: 71.7. Your grade: F. You failed the course.".
2. studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100) should return the following message: "Class average: 50.8. Your grade: A++. You passed the course.".
3. Your studentMsg function should return the correct message based on the student's score and the class average.
// tests completed
// console output
undefined

As you can see one line is missing from the base code for the A++ graded console.log.

Not a big deal, I just wrote the proper console.log command, but I think it is considered to be a bug.

Also the F graded console.log line is in the 34th line and 35th (wich is the last line of the code) is empty.

there is no line missing, if you want to add more console.logs to test your function feel free to do that

studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100)

should return the following message:

"Class average: 50.8. Your grade: A++. You passed the course."

.

This error message suggesting that there should be one more line with:
console.log(studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100));

The task itself doesn´t ask you to write that console.log down, but it appears as an error in the log.

Ergo the line is missing from the base code, like having -points in a shcool exam for a question didn´t asked in it.

no, it doesn’t appear as an error in the log
the test fails if the function does not return the correct output for the input, not if the console.log is absent

you are asked to write a function that does a certain thing, the console.log is outside the function so it doesn’t matter for the tests, but you can use it to test your function

I forgot to mention I already did the task before and noticed the missing line after completing it and started the task all over again it really wasn´t there.

This is what you see, when you open Task 4:

This is what you see after ctrl + Enter:

Error code 2.
So it is needed for completing the task.

No, it is not a bug. The test runs without you seeing it.

No, it is not needed to complete the task.
To pass the tests you need to write teh studentMsg function, what is outside the function is not needed.

The tests are saying that when the function is called with those values it needs to give that output. You can add the console.log to test what your function is returning, but it is not needed for the tests.

1 Like

I did the task again and error 2 didn´t appeared.

Guess the console.log line is hidden for the A++ grade, it was confusing at first, but now I see this is what you wanted to tell me and I don´t know than why I had an error message last time.
I´ve got the massage, than wrote the console.log for the A++ grade and than I succeded. Now it is different, maybe my code was a mess then.

If this is how the task intended to work, strange, but sorry for wasting your time than! It was really a very small confusing thing at first.

I still think the base code should have the console.log for evade further confusion for other beginners.

I call this the ‘peekaboo problem’. At some point learners need to understand that they don’t have to see a function call or logic for it to happen.

The console.log() lines are only for you to run your own tests.

Behind the scenes the platform will test your function with tests that you can’t see.

If all of the tests were visible as editable code, then there would have to be an additional test to check if the tests have been changed and if the tests are functioning correctly, an additional layer of complexity.

That said, all of freeCodeCamp works this way, so now you know.