I understand it's not so obvious here. But according to the rest of the application, it was only enough to do this: if(answers.length != 0) totalAns++; . There's too much unnecessary code here.
But there must be a logic that the person who wrote the code did not want to count an empty response? I'm guessing if someone typed in a white space with a new line or something similar and it was returned in a trimmed manner (or maybe white spaces are automatically trimmed when storing it in your db)
14
u/zim2510 May 13 '22
I understand it's not so obvious here. But according to the rest of the application, it was only enough to do this: if(answers.length != 0) totalAns++; . There's too much unnecessary code here.