am trying to handle undefined error in JavaScript
the console is dumping this error 
Uncaught TypeError: Cannot read property 'data' of undefined
my code :
try { 
FB.api(
  '/me/',
  'GET',
  {"fields":"posts{likes.limit(10){id,name}}"},
  function(response1) {
console.log(response1);
response1.posts.data[1].likes.data[0].id
if (typeof(response1.posts.data[1].likes.data[0].id) == 'undefined') { 
alert("error1");
}
});
} 
catch(err) { 
alert("erro2");
} 
what am doing wrong ?
 
     
    