简体   繁体   中英

Clojure Values in Clojurescript

I am testing om ( https://github.com/omcljs/om ) and I don't understand whats happen here:

I have a Clojure code that consume a API and put data into a vector. Then in my ClojureScript code I try:

(def urls (map (fn [c] (get c :url )) billings))
(def n (first urls))

(println n) ;; correct value
(.log js/console n) ;; null

Someone can explain this behavior ?

Thanks

If you are using a REPL, then println will—assuming you haven't issued (enable-console-print!) —generally print to your REPL. But, console.log goes to your browser's console output.

When you invoke (.log js/console n) , the REPL only prints the return value of console.log , so you see nil .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM