


Run your code and you’ll see the phrase This is an alert in your browser as a result of executing the second line: In this section, you’ll change the target platform to JS to run JavaScript from Kotlin.Ĭonsole.log("Hello " + args.joinToString()) On these kinds of projects, you’ll want to try a few things related to Kotlin and JavaScript interoperability. Kotlin/JS enables server-side web development, such as Node.js, and client-side web development, such as jQuery and React. It’s possible to call JavaScript from Kotlin and vice versa.

In the next sections, you’ll change the target platform to run JavaScript, draw to a Canvas and even run unit tests. It’s used to run JVM programs, such as the Hello World console app you modified. Note that the JVM target platform is already selected. In this section, you’ll learn what it means to your Kotlin code to change the target platform. Kotlin has the magical ability to run on different platforms. Great! Now that you can pass arguments into your playground, you’ll play around with changing the runtime virtual machine. Run the playground again and you’ll see the following output: Choose or type joinToString() to get the desired output: It’s better to show the names separated by commas, right? Do so by adding a dot to the right of the args parameter, and you’ll see the following: Run the program, and you’ll see the following output: Now, change main to receive those arguments: One way to test your Kotlin code is by passing in arguments into your playground. You’ll start by passing arguments into your app.

To open the playground, go to, where you’ll see the following: If you’re unfamiliar with the language, review our Kotlin for Android tutorial first. Note: This tutorial assumes you have experience developing in Kotlin.
