I am struggling to show an image using a <button>
element and it seems like there is an issue that I can't figure out.
Despite reading various resources on Javascript and OOP, I am still unsure if I have implemented the concepts correctly in my code.
Let me share with you how my code looks:
function myFunction() {
function Image(src, height, width) {
this.src = src;
this.height = height;
this.width = width;
}
image.prototype.display = function () {
document.body.appendChild(image);
}
var image = new Image("image.jpg", "200", "200");
image.display();
}
}
I really hope someone can assist me with this problem. Thank you! :)