vendredi 28 septembre 2018

i want to pass a path to an object

I want to pass a path with the function to the constructor

this.elementImg.src = `${this.changeImage()}`;  

Why this dont Work

changeImage = () => {
    if (this.speed < 6) {
        this.imagePaths[0];
    } else if (this.speed >= 6 && this.speed < 9) {
        this.imagePaths[1];
    } else if (this.speed >= 9) {
        this.imagePaths[2];
    }
}

Aucun commentaire:

Enregistrer un commentaire