All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.internals.array-to-reversed.js Maven / Gradle / Ivy

There is a newer version: 3.39.0
Show newest version
'use strict';
var lengthOfArrayLike = require('../internals/length-of-array-like');

// https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toReversed
// https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toReversed
module.exports = function (O, C) {
  var len = lengthOfArrayLike(O);
  var A = new C(len);
  var k = 0;
  for (; k < len; k++) A[k] = O[len - k - 1];
  return A;
};




© 2015 - 2024 Weber Informatics LLC | Privacy Policy