array are sorted. The sort must be stable (that is, elements that compare equal must remain in their original order). If comparefn is not undefined, it should be a function that accepts two arguments x and y and returns a negative value if x < y, zero if x = y, or a positive value if x > y. ・stable sort (※1)でなければならない (※2) ・比較関数は2つの引数を受け取って x<yなら負、x=yなら0、x>yなら正を返す ※1 同等なデータのソート前の順序がソート後も保存されるもの ※2 ES2019以降の仕様。ES2015の仕様だとstableとは限らない。ただし V8(v7.0以降)のソートアルゴリズムは stableなので実装はstable。
array are sorted. The sort must be stable (that is, elements that compare equal must remain in their original order). If comparefn is not undefined, it should be a function that accepts two arguments x and y and returns a negative value if x < y, zero if x = y, or a positive value if x > y. ・stable sort (※1)でなければならない (※2) ・比較関数は2つの引数を受け取って x<yなら負、x=yなら0、x>yなら正を返す ※1 同等なデータのソート前の順序がソート後も保存されるもの ※2 ES2019以降の仕様。ES2015の仕様だとstableとは限らない。ただし V8(v7.0以降)のソートアルゴリズムは stableなので実装はstable。 ・アルゴリズムの指定はない ・JSエンジンが異なれば異なるソート アルゴリズムが使われる