how to make a sprite javascript

JavaScript
let objectId = {};
objectId.x = 0;
objectId.y = 0;

//change positions
function updatePosition() {
  document.objectId.style.left = objectId.x;
  document.objectId.style.top = objectId.y;
}
//moving it
function move() {
  objectId.x++;
  objectId.y++;
  updatePositions();
}
var name = createSprite(x,y,width,height);let objectId = {};
objectId.x = 0;
objectId.y = 0;

//change positions
function updatePosition() {
  document.objectId.style.left = objectId.x;
  document.objectId.style.top = objectId.y;
}
//moving it
function move() {
  objectId.x++;
  objectId.y++;
  updatePositions();
}
Source

Also in JavaScript: