[js] undefined is greater than any other value
[js] Array.sort(): support comparefn. Push undefined values towards end