title: (Javascript) How can I pick a random variable out of 4 possible and use their values (x and y coordinates) to draw an image on Canvas?
body: <p>In Javascript (Canvas) I want to draw an image in one of 4 random locations. I created 4 variables with an x and y value as shown:</p>
  <p><code>    var spawn1 = { x: -300, y: Math.floor(Math.random() * (canvas.height + 1)), } var spawn2 = { x: canvas.width + 300, y: Math.floor(Math.random() * (canvas.height + 1)), } var spawn3 = { x: Math.floor(Math.random() * (canvas.width + 1)), y: -300, } var spawn4 = { x: Math.floor(Math.random() * (canvas.width + 1)), y: canvas.height + 300, }</code></p>
  <p>How would I go about picking one of these randomly and then using its x and y value to draw an image with those coordinates? I really don't know how to proceed from here, or if there's a better solution.</p>