Spaces:
Runtime error
Runtime error
File size: 319 Bytes
6425e7e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
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) |