Reversing an array in different ways is one of the most popular questions you can expect to get at a JavaScript interview. In this article, I will present three ways to reverse an array, and using a built-in
reverse
method is not going to be one of them.
This method
reverses an array by modifying it, which means the first element in the original array becomes the last element and the last one becomes the first. An array can be reversed by both modifying the original array or without changing the original array.
[R eversing以不同的方式数组是你可以期望获得在JavaScript的采访中最流行的问题之一。 在本文中,我将介绍三种反转数组的方法,而使用内置的
reverse
方法将不是其中一种。
Reversing an array in different ways is one of the most popular questions you can expect to get at a JavaScript interview. In this article, I will present three ways to reverse an array, and using a b...