js: 结果等于 eval(字符串);
java: ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName("JavaScript");
结果等于 engine.eval(字符串);
简写:结果等于 (new ScriptEngineManager()).getEngineByName("JavaScript").eval(字符串);
时间: 2024-12-19 10:19:04