JSValue value = ...; // some JSValue object if (value.isUndefinedOrNull()) { // Do something if value is undefined or null. } else { // Do something if value is not undefined or null. }
JSValue result = engine->evaluate("myFunction()"); if (!result.isUndefinedOrNull()) { // Use the result value. }In this example, we're using the `evaluate` method to execute a JavaScript function and store the result in a JSValue object named `result.` Before using the result value, we check whether it's undefined or null using the `isUndefinedOrNull` method. Package library: The JSValue class is part of the JSCore library, which is included with the WebKit and Blink rendering engines used by browsers such as Safari and Chrome. It's also available as a standalone library for use in other C++ applications.