Using the V8 engine, how do I set a value to null
? Basically I want to return a variable from a C++ addon to JavaScript, and the variable needs to be set to null
under certain conditions.
You can explicitly return null
via v8::Null
:
return scope.Close( Null() );
Also, it turns out that if a Value
variable is declared, it is automatically assigned to undefined
. For example, the following returns undefined
back to JavaScript:
HandleScope scope;
Local<Value> result;
...
return scope.Close(result);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With