Search⌘ K
AI Features

Transpiling to JavaScript

Discover how to transpile Kotlin source code into JavaScript using command-line tools and run the output in Node.js or browsers. Understand the advantages of using Kotlin's static typing for front-end development and explore setup steps for runtime libraries and execution.

Front-end development is gaining momentum, and there’s an increasing demand for full-stack developers. JavaScript has evolved significantly in recent years, but it’s a dynamically typed language and also a weakly typed language—–see Rediscovering JavaScriptVenkat Subramaniam. Rediscovering JavaScript. The Pragmatic Bookshelf, Raleigh, NC, 2018. In recent years, some programmers have gravitated toward statically typed languages, for example TypeScript, that will transpile to JavaScript. Statically typed languages can help find errors early, during compile time, and remove certain problems that may creep up during runtime if the code was written directly in JavaScript.

Languages like TypeScript offer static typing, but languages like Kotlin bring in that and a lot more. If you’re going to choose static typing for front-end development, why stop at languages like TypeScript, when you could go all the way and benefit from the wealth of features of a powerful language like Kotlin? Kotlin makes it easier to create common code and to reuse code between platforms. You can also use Kotlin DSLs for HTML and CSS and thus use Kotlin for the entire front-end ...