Kotlin JavaScript Overview
Kotlin JavaScript Overview
Kotlin provides the ability to target JavaScript. It does so by transpiling Kotlin to JavaScript. The current implementation targets ECMAScript 5.1 but there are plans to eventually target ECMAScript 2015 also.
When you choose the JavaScript target, any Kotlin code that is part of the project as well as the standard library that ships with Kotlin is transpiled to JavaScript. However, this excludes the JDK and any JVM or Java framework or library used. Any file that is not Kotlin will be ignored during compilation.
The Kotlin compiler tries to comply with the following goals:
- Provide output that is optimal in size
- Provide output that is readable JavaScript
- Provide interoperability with existing module systems
- Provide the same functionality in the standard library whether targeting JavaScript or the JVM (to the largest possible degree).