DEV Community

S M Ashraful Azom
S M Ashraful Azom

Posted on

Answer: How to Fix Uncaught ReferenceError: thumbnail is not defined - with below code

it happens because some posts does not have images or images hosted externally, we can use a fallback image like this

for (var i = 0; i < json.feed.entry.length; i++) { var title = json.feed.entry[i].title.$t var url = json.feed.entry[i].link.pop().href; // define thumbnail variable var thumbnail; if (json.feed.entry[i].media$thumbnail) { thumbUrl =

Top comments (0)