0

I am building a python application that needs to run some javascript code. I have node.js installed. I want to define a function in javascript and then be able to run it elsewhere in the program. Here is an example:

#My javascript function:
js_code = """
function add(a,b){return a+b};
"""
#Define js function here

myVar = add(3,4) #run the add function here


2
  • Does this answer your question? Executing Javascript from Python Commented Apr 3, 2020 at 0:22
  • @SuperStormer I am using python 3.8 and PyV8 is not in python 3.x. Commented Apr 3, 2020 at 0:30

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.