SyntaxFix
Write A Post
Hire A Developer
Questions
the most terse solution would be to change return results[1] || 0; to return (results && results[1]) || 0.
return results[1] || 0;
return (results && results[1]) || 0