JSFiddle - React, Tailwind, and code Playground
JavaScript
var img1 = document.createElement('img');
img1.onerror = function() {
console.log('img1 fail');
};
img1.onload = function() {
console.log('img1 success');
};
img1.src = 'http://gvgmaps.com/linktothepast/maps/LegendOfZelda-ALinkToThePast-LightWorld.png';
var img2 = document.createElement('img');
img2.onerror = function() {
console.log('img2 fail');
};
img2.onload = function() {
console.log('img2 success');
};
img2.src = 'http://placehold.it/350x150';