Hacker News new | ask | show | jobs
by hhariri 4597 days ago
Kotlin compiles down to JVM Bytecode, which will could be considered another language, is what's required to run on the JVM. That's the JVM Target.

Now, from the JavaScript target, yes, it compiles down to JavaScript, but it does so in a way that it not only provides sourcemaps to be able to debug, but also be consumed from JavaScript via Common JS modules for instance, thus allowing you to interact from JavaScript with the code you've written in Kotlin. Think for instance replication of some business logic on both client and server which is quite common.

Finally, in regard to writing Kotlin versus JavaScript, well Kotlin has it's advantages if you prefer static typing and want some of the benefits that language provides. If you're comfortable with JavaScript, if you prefer dynamic languages, then there's little reason to use Kotlin to compile to JavaScript (except the previous scenario of sharing code).