13 lines
419 B
JavaScript
13 lines
419 B
JavaScript
'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;
|
|
};
|