I'm trying to load a picture and somehow it's throwing me an error, I've tried different ways but I can't fix it. Can anyone help me? Thank you for your answers.
class Sprite {
constructor({position, imageSrc, scale = 1, framesMax = 1}) {
this.position = position
this.width = 50
this.height = 150
this.image = new Image()
this.image.src = imageSrc // here the inspector shows an error
this.scale = scale
this.framesMax = framesMax
this.framesCurrent = 0
this.framesElapsed = 0
this.framesHold = 6
}`
const player = new Fighter({
position: { x:0, y:0 }, velocity: { x: 0, y: 0 }, offset: { x: 0, y: 0 }, imageSrc: './img/samuraiMack/Fall.png', framesMax: 8 })