Solution for Rosetta Code: JortSort

What is your hint or solution suggestion?
There are a few things to know here. Directly changing the array also changes the original array, so a shallow copy must be created first. Using Array.sort sorts the items alphabetically, so a way to sort them numerically must be used. Finally, the arrays have to be converted using JSON.stringify into a format where it is possible to test equality.

Solution 1
function jortsort(array) {
    var arrayCopy = [...array];
    array.sort((a, b) => a - b);
    return JSON.stringify(array)==JSON.stringify(arrayCopy);
}

Challenge: JortSort

Link to the challenge: