Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

js/console.log in ClojureScript

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 ?

like image 980
HM.Yang Avatar asked Jun 16 '14 08:06

HM.Yang


People also ask

How do I run a JavaScript console log?

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".

Can we write console log in JavaScript?

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.

Can you use console log HTML?

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.


1 Answers

You can also just use println if you first put this at top of your file: (enable-console-print!).

like image 189
johnbakers Avatar answered Oct 07 '22 02:10

johnbakers