Kotlin Sort Array Javascript Iteration