You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
643 B
23 lines
643 B
'use strict'; |
|
var $export = require('./_export'); |
|
var aFunction = require('./_a-function'); |
|
var toObject = require('./_to-object'); |
|
var fails = require('./_fails'); |
|
var $sort = [].sort; |
|
var test = [1, 2, 3]; |
|
|
|
$export($export.P + $export.F * (fails(function () { |
|
// IE8- |
|
test.sort(undefined); |
|
}) || !fails(function () { |
|
// V8 bug |
|
test.sort(null); |
|
// Old WebKit |
|
}) || !require('./_strict-method')($sort)), 'Array', { |
|
// 22.1.3.25 Array.prototype.sort(comparefn) |
|
sort: function sort(comparefn) { |
|
return comparefn === undefined |
|
? $sort.call(toObject(this)) |
|
: $sort.call(toObject(this), aFunction(comparefn)); |
|
} |
|
});
|
|
|