QScriptEngine engine; QScriptValue val = engine.newObject();
QScriptValue globalObject = engine.globalObject(); QScriptValue console = globalObject.property("console");
QScriptValue func = globalObject.property("alert"); QScriptValueList args; args << "Hello, world!"; func.call(globalObject, args);This code calls the "alert" function in JavaScript with the argument "Hello, world!". These examples are part of the "QtScript" library, which is a package library in the Qt framework for working with JavaScript code in C++.