Attention: “JS Nashorn Comparator” Version 1.0 had an unforeseen bug! 
Apparently, Nashorn can’t “see” objects’ non-public members! 
Therefore, both the class MyVec and its fields x, y, z had to be explicitly declared as public in order for Nashorn’s code to access them. 
Otherwise, the field x would be undefined inside Nashorn’s callback function! 
Issue is fixed now under version 1.1! 