Overview
The comparison function for Array.sort must obey a specific set of properties, otherwise the result will be undefined. It must be pure, stable, reflexive, anti-symmetric and transitive. You can type in some JavaScript code here to see whether it would be considered acceptable.
Initialize an array. Define a comparison function compare(a,b) that returns 0 if the two parameters are considered equal, -1 (or negative) if a is less than b (i.e., a should precede b in the output) and 1 (or positive) if b is less than a. Invoke the Array_sort(array,compare) function with the array and the comparison function as arguments. It will evaluate it and output the sorted result and note any inconsistency about the comparison function.
developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort
Requirements
You can install a web browser that supports at least JavaScript 1.0 (1995) to use this tool or you may consider implementing a GemiWeb0 browser with JavaScript0 yourself according to the following specification:
bkil.gitlab.io/gemiweb0
Test