how to assign image to a variable in javascript code example
Example: how to assign image to a variable in javascript
<div id="x"></div>
<script>
var img = document.createElement("img");
img.src = "image.png";
var src = document.getElementById("x");
src.appendChild(img);
</script>