iShare's picture
Create app.py
6425e7e
raw
history blame
319 Bytes
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)