Add polyfill for toSorted

Fixes #2827
This commit is contained in:
Cohee 2024-09-11 20:35:42 +03:00
parent e0c3ac84a2
commit 80d27273a2
1 changed files with 6 additions and 0 deletions

View File

@ -11,3 +11,9 @@ if (!Array.prototype.findLastIndex) {
return -1;
};
}
if (!Array.prototype.toSorted) {
Array.prototype.toSorted = function (compareFunction) {
return this.slice().sort(compareFunction);
};
}