SyntaxFix
Write A Post
Hire A Developer
Questions
Just check if response[0] is undefined:
response[0]
if(response[0] !== undefined) { ... }
If you still need to explicitly check the title, do so after the initial check:
if(response[0] !== undefined && response[0].title !== undefined){ ... }