Every global object or variable in SSJS is an object of a class defined in Java. The statement
Object.prototype.toString.call([]);
is for JavaScript not for Java. That's why the error. If you wish to find out the class to which the object belongs in SSJS then you can call .getClass().getName()
.
obj.getClass().getName()
You can find more information here.