Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

call function

You need to install js2py or requests-html packages to run the JavaScript program from Python

//example :
//javaScript function : squareofNum()
code in python : 
import js2py

squareofNum = "function f(x) {return x*x;}"

result = js2py.eval_js(squareofNum)

print(result(5))
>>output : 25
 
PREVIOUS NEXT
Tagged: #call #function
ADD COMMENT
Topic
Name
6+3 =