What is ClojureScript?

September 11, 2015

Summary: ClojureScript is Clojure that compiles to JavaScript. It combines the power of Clojure with the reach of JavaScript.

ClojureScript is a version of Clojure that compiles to JavaScript. Clojure is a functional programming language for the Java Virtual Machine. Because ClojureScript compiles to JavaScript, it can run in all browsers, on mobile devices, and on Node.js. You get the power of Clojure and the reach of JavaScript.

If you are writing JavaScript and you like Clojure, you should explore using ClojureScript. It's on the ThoughtWorks Technology Radar and many large companies are using it in production. It's a great time to give it a try.

There is also an active community that is happy to help you get started. You can join them on IRC (#clojurescript on freenode.net), on Slack, and on the mailing list. In addition, please ask me any questions by or asking on the PurelyFunctional.tv discussion board.

Who makes it?

ClojureScript is maintained by Cognitect, the same company that maintains Clojure itself. It is under very active development and the versions are now in lock step. Since version 1.7, many libraries work out of the box in both Clojure and ClojureScript.

Not your typical Compile-to-JS language

ClojureScript programs are often shorter than equivalent JavaScript programs. ClojureScript is higher-level and includes a large standard library that works across all JavaScript engines.

ClojureScript is not just JavaScript with a different syntax. It has Clojure's well-designed semantics--immutable data structures, multiple-arity functions, data structure literals, protocols, and more. And it's also got great interoperation with JavaScript. That means you can always drop down to JavaScript when you need to. Any existing JavaScript library is usable from ClojureScript.

ClojureScript leverages the Google Closure Compiler (what Google uses to write Gmail, among other services) to minify the code much more than your typical minifier can. Google Closure includes dead code elimination and other advanced optimization techniques to include only code you need before it minifies it. This means you can include entire libraries and have Google Closure remove the parts you don't need. Dependencies do not bloat the final JavaScript download.


ClojureScript is a powerful tool for building web applications. It has the power of Clojure, the economy of the Google Closure Compiler, and the reach of JavaScript. Many companies are using it and the future looks very bright. If you're interested in getting started with ClojureScript, I recommend LispCast Single Page Applications with ClojureScript and Om. It uses Om (a React wrapper) to build an application from the ground up. The course teaches everything you need using animations, exercises, code screencasts, and more. It's the fastest and most effective way to learn to build Om applications.

You might also like