Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

graal.js pass javascript array to java function

Context context = Context.newBuilder("js").build();
Value result = context.eval("js", "var list=[1,2,'foo',true]; list;");
if (result.hasArrayElements()) {
    for (int i=0;i<result.getArraySize();i++) {
        System.out.println(result.getArrayElement(i));
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pass #javascript #array #java #function
ADD COMMENT
Topic
Name
3+7 =