esnext.array.to-reversed.js 619 B

123456789101112131415161718
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var global = require('../internals/global');
  4. var arrayToReversed = require('../internals/array-to-reversed');
  5. var toIndexedObject = require('../internals/to-indexed-object');
  6. var addToUnscopables = require('../internals/add-to-unscopables');
  7. var Array = global.Array;
  8. // `Array.prototype.toReversed` method
  9. // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toReversed
  10. $({ target: 'Array', proto: true }, {
  11. toReversed: function toReversed() {
  12. return arrayToReversed(toIndexedObject(this), Array);
  13. }
  14. });
  15. addToUnscopables('toReversed');