blob: d01f55bf9c9e774e3ef68c70eef1152f6636284b [file] [log] [blame]
'use strict';
var $export = require('./_export')
, aFunction = require('./_a-function')
, toObject = require('./_to-object')
, fails = require('./_fails')
, $sort = [].sort
, 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));
}
});