Passing results from Javascript to Applescript

set the_result to do JavaScript "return(10)" in document 1
get the_result

Gives me an error, saying that the_result is not defined. What am i missing? Searched the forum and every post showing such solution, leads me to the same error message. Did Apple change something?

Im NOT sure what you are doing here as you don’t mention any app. But ‘return’ is reserved for inside of a function. So you need to declare a function have your value returned from inside of this. Call your function.

This worked with Safari for me.

tell application "Safari"
	do JavaScript "function myValue() {return 10;} myValue();" in document 1
	display dialog the result
end tell

Sorry, i didn’t mention that it was in Safari. Thanks for your answer. I had the same suggestion meanwhile. I thought, it might be like a function call with a returned value what’s inside the quotation marks of DO JAVASCRIPT. But it seems the result is nothing more than the logical value of javascript expression itself?