0

I have a bird={} object, and I want the bird object to have an image to represent it, but I need to have other properties inside the bird other than its image. How do I do that? Thanks in advance.

3 Answers3

0

you can use base64. link

var bird = { IMAGE:"data-image/png;AAASFS..." }

Or you can keep image location like that;

var bird = { URL:"C:/Users/..../bird.png" }
Community
  • 1
  • 1
cbalakus
  • 620
  • 7
  • 15
0

You can simply use the following code to create a HTML DOM Image Object.

var bird = new Image();
bird.src = "http://www.ImageURL.png";
user7393973
  • 2,270
  • 1
  • 20
  • 58
0

Try something like this:

var bird =  {color: "blue", weight: 30, eyeColor:"#0000ff", imageSoure: "C:/Users/..../bird.png"};