if the string is arbitrary javascript, the best so...
# getting-started
p
if the string is arbitrary javascript, the best solution is probably calling nashorn