mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 00:01:37 +08:00
chore: convert functions to an ES2015 classes (#1656)
* chore: convert functions to an ES2015 classes * remove unnecessary functions
This commit is contained in:
@ -7,11 +7,9 @@
|
||||
|
||||
const Reverse = (arr) => {
|
||||
// limit specifies the amount of Reverse actions
|
||||
for (let i = 0, j = arr.length - 1; i < arr.length / 2; i++, j--) {
|
||||
const temp = arr[i]
|
||||
arr[i] = arr[j]
|
||||
arr[j] = temp
|
||||
}
|
||||
for (let i = 0, j = arr.length - 1; i < arr.length / 2; i++, j--)
|
||||
[arr[i], arr[j]] = [arr[j], arr[i]]
|
||||
|
||||
return arr
|
||||
}
|
||||
export { Reverse }
|
||||
|
Reference in New Issue
Block a user