is there a writeup of how null/undefined is being ...
# javascript
b
is there a writeup of how null/undefined is being handled? it looks as if "var?.value" returns null and not undefined as the JS counterpart (which is great btw); are all undefined values from native JS APIs coerced into nulls? I know there's "undefined" as well as Nothing?
1
t
Copy code
fun f(a: Any?) {
   a === null // is null
   a === undefined // is undefined 
}
are all undefined values from native JS APIs coerced into nulls?
From JS API you will receive original values
Single exception - external functions, which return
Unit
b
thank you
e
Also know that
void 0
is used to represent
undefined
. A
void 0
variable is passed to external functions with optional parameter, for example.
Copy code
external class Example {
    constructor(one: String, two: String = definedExternally, three: String)
}

val e = Example(one = "o", three = "t")
Translates to
Copy code
var e = new Example('o', VOID, 't');
👍 1
🙌 1