JSFiddle - React, Tailwind, and code Playground

HTML

<div>Expected value: <b>width 16px</b></div>
<div>Actual value: <b id="ret">loading...</b></div>

JavaScript

var image = function(s,l){with(new Image)onload=onerror=function(){l(this)},src=s};

image('http://yandex.ru/favicon.ico', function (img) {
    document.getElementById( "ret" ).innerHTML = 'width ' + img.width  + 'px'
})