Unfortunately`js("p in this")` translates to `p in...
# javascript
a
Unfortunately`js("p in this")` translates to
p in this
, not to
p in $receiver
. Thus the temporary
obj
variable.
f
I'd say fortunately 😄
a
😅
There is a way to avoid the unnecessary assignment in JS code:
Copy code
inline fun contains(obj: Any?, p: String): Boolean {
    return js("p in obj").unsafeCast<Boolean>()
}

inline operator fun Any?.contains(p: String) = contains(this, p)
println("foo" in a)
=>
println('foo' in a);
But it aint so pretty