In the following recipe, we are going to configure and implement a sample web app project in order to explore how Kotlin can be compiled to JavaScript. We are going to implement a simple web app that will open an alert dialog when the app starts. The following example is going to present a way of combining Kotlin and JavaScript code together and configuring a JavaScript compilation with the Gradle build script.
Kotlin and JavaScript interoperability
Getting ready
In order to set up the project to compile Kotlin files into JavaScript, we need to add the following properties to the module-level Gradle build script. First, we need to apply the Kotlin2Js plugin. We can do it with the following declaration:
apply plugin: "...