283
CHAPTER 10: Development
Create the file
Main.kt
inside
src/main/kotlinjs
and add content to it as follows:
import kotlin.browser.document
fun main(args: Array
) {
val message = "Hello JavaScript!"
document.getElementById("cont")!!.innerHTML = message
}
In the end we will be targeting a web site, so we need a first HTML page as well. Make it the
standard landing page
index.html
, create it inside
src/main/web
, and enter the following:
Kotlin-JavaScript
src="kotlin.js">
src="kotlinjsSample.js">Dostları ilə paylaş: