When transpiling to javascript, what does the kotl...
# javascript
h
When transpiling to javascript, what does the kotlin compiler do to
vararg
function parameters? In a function of mine, there is only one parameter, and it is defined as
vararg tags: String
. Inside the function, I collect the vararg into a list:
tags.asList()
. In the produced js, the parameter is of course named
tags
, and I find this in the function body:
asList(tags)
. But wait... This takes the first string passed in and turns it into a character list.
s
Just want to share a fast way to see what Kotlin/JS compiler does without having it installed or project configured: - Go to https://try.kotlinlang.org/ - Set target to JavaScript - Write code - Run ▶️ - Open Generated JavaScript code tab at the bottom We use this all the time.
😄 5
n
Does that method allow experimenting with the DOM and seeing the effects/changes in real time?