W3cubDocs

/Kotlin

get

Platform and version requirements: JS (1.1)
abstract operator fun get(propertyName: String): Any?

Calls to the function will be translated to indexing operation (square brackets) on the receiver with propertyName as the argument.

E.g. for next code:

fun test(j: Json, p: String) = j["prop"] + j.get(p)

will be generated:

function test(j, p) {
    return j["prop"] + j[p];
}

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.js/-json/get.html