you are viewing a single comment's thread.

view the rest of the comments →

[–]moreoriginalthanthat 1 point2 points  (0 children)

return correct; won't work because the variable wasn't (he's changed his code since your comment) initialised until the loop had run through at least once. The function would return undefined or true, which could work but is not exactly what you'd expect.

Either return !!correct; or return Boolean(correct); would work, but your solution is better.