I'm getting the error "Uncaught TypeError: Cannot read property 'thumbnail' of undefined" and I don't know how to fix it. I'm using Google Book API and I'm getting this error. I don't understand this because before I use thumbnail I checked if this element exists and still getting this error.
JS:
if(Ui.checkIfExist(response.items[i].volumeInfo.imageLinks.thumbnail) &&
response.items[i].volumeInfo.imageLinks.thumbnail.length>0){
var img = document.createElement('div');
img.classList.add('img-book');
responseItem.appendChild(img);
img.innerHTML = "<img src=" + response.items[i].volumeInfo.imageLinks.thumbnail+">"+"</img>";
}