Google V8 JavaScript Engine - How to set null?

Using the V8 engine, how do I set null ? Basically I want to return a variable from a C ++ addon to JavaScript, and under certain conditions the variable should be set to null .

+4
source share
1 answer

You can explicitly return null through v8::Null :

 return scope.Close( Null() ); 

It also turns out that if a Value variable is declared, it is automatically assigned undefined . For example, the following returns undefined to JavaScript:

  HandleScope scope; Local<Value> result; ... return scope.Close(result); 
+10
source

Source: https://habr.com/ru/post/1344717/


All Articles