I want to create an JavaScript Image object and set the src property. I tried:
(set! (.-src (js/Image. 80 80)) "foo.png")
But the return value of this will be "foo.png".
How do I set the src property and return the #<[object HTMLImageElement]>?
Ultimately I want to create a sequence of images with the sources "1.png", "2.png"... so was hoping the following would work:
(map (fn [x] (aset (js/Image. 80 80) "src" (str x ".png"))) (range 0 11))
mapis lazy, so you might not get what you expect. You may want to go withdoseq, instead.