/* Suppose we have a JavaScript object
var x = {
a: 2,
b: "hello",
c: function(v) {
return this.a + v;
}
}
in the global scope. */
?- prop(x, X), prop(X, a, Value).
% X = (object), Value = 2.
?- prop(x, X), prop(X, b, Value).
% X = (object), Value = hello.
?- prop(x, X), prop(X, c, Value).
% X = (object), Value = (function).
?- prop(x, X), prop(X, Property, Value).
% X = (object), Property = a, Value = 2 ;
% X = (object), Property = b, Value = hello ;
% X = (object), Property = c, Value = (function).