mirror of
https://github.com/zekexiao/pocketlang.git
synced 2025-02-11 15:16:41 +08:00
fix(bench): do not double-reverse in list.js
file (#133)
This commit is contained in:
parent
aba0546c2a
commit
6ce5c9f57e
@ -1,6 +1,9 @@
|
|||||||
function reverse(list) {
|
function reverse(list) {
|
||||||
var i=0, tmp, idx, count=list.length;
|
var i=0, tmp, idx;
|
||||||
for (; i < count; i++) {
|
var count = list.length;
|
||||||
|
var max = count / 2 | 0;
|
||||||
|
|
||||||
|
for (; i < max; i++) {
|
||||||
idx = count - i - 1;
|
idx = count - i - 1;
|
||||||
tmp = list[idx];
|
tmp = list[idx];
|
||||||
list[idx] = list[i];
|
list[idx] = list[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user