Hi everyone,
I’m having a problem with the challenge grader.
None of the test cases when my algorithm is supposed to return a string are graded correctly.
I’m referring to the cases when the cash-in-drawer is less than or equal to the change due. We’re supposed to return “Insufficient Funds”, or “Closed”, which is what is returned (and printed on the output console) when I run my code. However, the grader still says I’m doing something wrong.
Here’s a snippet of the code:
var change = cash - price;
if (change > cashInDrawer) { // cashInDrawer is calculated before this snippet
return 'Insufficient Funds';
}
if (change === cashInDrawer) {
return 'Closed';
}
Attached is a screenshot of the grader results. As you can see, all the other test cases are working correctly.
What could be wrong?
Thanks in advance for your help.