JSFiddle - React, Tailwind, and code Playground

JavaScript

function Texture(url){
	this.image = new Image();
  this.image.src = url;
  this.image.onload = function(){
  	this.width = this.image.width;
    this.height = this.image.height;
  }
}

text = new Texture("http://insane96mcp.altervista.org/Invaders/assets/sprites/player.png");

document.body.innerHTML += text.image + "<br>";
document.body.innerHTML += text.src + "<br>";
document.body.innerHTML += text.width + "<br>";