I have two code snippets that I assumed to both result in alerts. However the first results none while the second performs the alerts.
(map #(.alert js/window %) ["hey1" "hey2"])
This slight modification prints (nil nil) as expected, as well as fixing the alert issue. The question being WHY?
(print (map #(.alert js/window %) ["hey1" "hey2"]))
Another weird observation is that the first snippet works from a browser-repl, but not when typed into code.
Is the map function side effect free, but print is not? Maybe some core code optimization I do not know about?
Work-arounds and answers are both appreciated. If you need more info please let me know in a comment.
[org.clojure/clojurescript "1.8.51"]
BOOT_CLOJURE_VERSION=1.7.0
BOOT_VERSION=2.5.5
java version "1.8.0_101"
Description: Ubuntu 14.04.4 LTS