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.
22 lines
720 B
22 lines
720 B
2 years ago
|
'use strict';
|
||
|
var $ = require('../internals/export');
|
||
|
var $includes = require('../internals/array-includes').includes;
|
||
|
var fails = require('../internals/fails');
|
||
|
var addToUnscopables = require('../internals/add-to-unscopables');
|
||
|
|
||
|
// FF99+ bug
|
||
|
var BROKEN_ON_SPARSE = fails(function () {
|
||
|
return !Array(1).includes();
|
||
|
});
|
||
|
|
||
|
// `Array.prototype.includes` method
|
||
|
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
||
|
$({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
|
||
|
includes: function includes(el /* , fromIndex = 0 */) {
|
||
|
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
||
|
}
|
||
|
});
|
||
|
|
||
|
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
||
|
addToUnscopables('includes');
|