Spaces:
Runtime error
Runtime error
import execjs | |
# Define some JavaScript code | |
js_code = """ | |
function addNumbers(a, b) { | |
return a + b; | |
} | |
var result = addNumbers(2, 3); | |
""" | |
# Use execjs to execute the JavaScript code | |
ctx = execjs.compile(js_code) | |
# Get the result of the JavaScript code | |
result = ctx.eval('result') | |
# Print the result | |
print(result) |