function load(url) { imgObj the let = new new Image (); // create a picture object imgObj.src = url; IF (imgObj.complete) { console.log('is loaded') } else { imgObj.onload = () => { console.log('loading success') }; imgObj.onerror = () => { console.log('loading error') } } }