I want to implement a function with ClojureScript to simplify js/console.log
like this:
(defn log [& args]
(apply js/console.log args))
Calling it : (log "foo" "bar")
throws: TypeError: Illegal invocation
but this works : (js/console.log "foo" "bar")
What is the problem ?
With the Chrome browser open, right-click anywhere in the browser window and select Inspect from the pop-up menu. By default, the Inspect will open the "Elements" tab in the Developer Tools. Click on the "Console" tab which is to the right of "Elements".
log() The console. log() method outputs a message to the web console. The message may be a single string (with optional substitution values), or it may be any one or more JavaScript objects.
The console. log() method in HTML is used for writing a message in the console. It indicates an important message during testing of any program. The message is sent as a parameter to the console.
You can also just use println if you first put this at top of your file: (enable-console-print!)
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With