JSFiddle - React, Tailwind, and code Playground

JavaScript

var img = new Image();
var url = "http://www.vbarter.com/images/content/3/2/32799.JPG";
img.onload = function(){
    alert("the image exists");   
};
img.onerror = function(){
    alert("error while loading..");   
}

img.src = url;