1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
function foo1(x, n) {
var i = 0;
while (--n >= 0) {
x[i++] = 0;
}
}
foo1([1,2,3,4,5],5);
function foo2(x, n) {
var i = 0;
while (--n >= 0) {
x[i++] = 0;
}
}
foo2([1,2,3,4,5],6);
function foo3(x, n) {
var i = 0;
while (n-- >= 0) {
x[i++] = 0;
}
}
foo3([1,2,3,4,5],5);
function foo4(x, n) {
var i = 0;
while (--n >= 0) {
x[++i] = 0;
}
}
foo4([1,2,3,4,5],5);
function foo5(x, n) {
var i = 0;
while (--n >= 0) {
x[++i] = 0;
}
}
foo5([1,2,3,4,5,6],5);
|