Name
JSObject.eval( ): evaluate a string of JavaScript code â Java method in Java plug-in
Synopsis
public Object eval(Strings
)
Arguments
-
s
A string that contains arbitrary JavaScript statements separated by semicolons.
Returns
The JavaScript value of the last expression evaluated in
s
, converted to a Java object.
Description
The eval( )
method of the
Java JSObject class evaluates the JavaScript code contained in the
string s
in the context of the JavaScript
object specified by the JSObject. The behavior of the eval( )
method of the Java JSObject class
is much like that of the JavaScript global eval( )
function.
The argument s
may contain any
number of JavaScript statements separated by semicolons; these
statements are executed in the order in which they appear. The
return value of eval( )
is the
value of the last statement or expression evaluated in
s
.
Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.