Invoke a JavaScript global function with a list of arguments.
Description
apply( +atom, +list, -term )
apply( +JSValueFUNCTION, +list, -term )
Same as apply/4 with the global object as context. apply(Method, Arguments, Value) is equivalent to global(Context), apply(Context, Method, Arguments, Value).
/*
Suppose we have a JavaScript function
var succ = function(x) { return x+1; };
in the global scope.
*/
?- prop(succ, Succ), apply(Succ, [1], Value).
% Succ = (function), Value = 2.