How do you pass an image as argument in a function/class or is this impossible and if it is how would I fix it? For example:
var tree = new Image();
tree.src = "img/statobj/tree.png"
function additem(dimage){
document.getElementById("myitems").rows[0].insertCell(0).innerHTML ='<div id="invetoryitem" >'+ this.dimage + '</div>'
console.log(dimage) //gets undefined
}
I've tried dimage.src and other methods but nothing I use seems to work :/
function(dimage)is invalid syntax