Lines Matching refs:a
41 var a = [0,1];
42 assertArrayEquals([0], a.filter(function(n) { return n == 0; }));
43 assertArrayEquals([0,1], a);
47 a = [1,42,3,42,4];
49 a.filter(function(n) { return this.value == n }, o))
52 a = [1,42,3,42,4];
54 a.filter(function(n, index, array) {
57 assertArrayEquals([43,43,43,43,43], a);
61 a = [1,1];
63 a.filter(function(n, index, array) { array.push(n+1); return n == 2; }));
64 assertArrayEquals([1,1,2,2], a);
67 a = new Array(20);
69 a[2] = 2;
70 a[15] = 2;
71 a[17] = 4;
72 var a = a.filter(function(n) { count++; return n == 2; });
74 for (var i in a) assertEquals(2, a[i]);
78 a = [];
79 [1, 2].filter(function() { a.push(this) }, "");
80 assertTrue(a[0] !== a[1]);
83 a = [];
84 [1, 2].filter(function() { a.push(this) }, {});
85 assertEquals(a[0], a[1]);
88 a = [];
89 [1, 2].filter(function() { 'use strict'; a.push(this); }, "");
90 assertEquals("", a[0]);
91 assertEquals(a[0], a[1]);
101 var a = [0,1];
103 a.forEach(function(n) { count++; });
109 a.forEach(function(n) { result.push(this.value); }, o);
113 a = [0,1];
115 a.forEach(function(n, index, array) { array[index] = n + 1; count++; });
117 assertArrayEquals([1,2], a);
121 a = [1,1];
123 a.forEach(function(n, index, array) { array.push(n+1); count++; });
125 assertArrayEquals([1,1,2,2], a);
128 a = new Array(20);
130 a[15] = 2;
131 a.forEach(function(n) { count++; });
136 a = [];
137 [1, 2].forEach(function() { a.push(this) }, "");
138 assertTrue(a[0] !== a[1]);
141 a = [];
142 [1, 2].forEach(function() { a.push(this) }, {});
143 assertEquals(a[0], a[1]);
146 a = [];
147 [1, 2].forEach(function() { 'use strict'; a.push(this); }, "");
148 assertEquals("", a[0]);
149 assertEquals(a[0], a[1]);
159 var a = [0,1];
160 assertFalse(a.every(function(n) { return n == 0 }));
161 a = [0,0];
162 assertTrue(a.every(function(n) { return n == 0 }));
167 a = [0];
168 assertFalse(a.every(function(n) { return this.value == n; }, o));
169 a = [42];
170 assertTrue(a.every(function(n) { return this.value == n; }, o));
173 a = [0,1];
175 a.every(function(n, index, array) {
178 assertArrayEquals([1,1], a);
182 a = [1,1];
184 a.every(function(n, index, array) {
187 assertArrayEquals([1,1,2,2], a);
190 a = new Array(20);
192 a[2] = 2;
193 a[15] = 2;
194 assertTrue(a.every(function(n) { count++; return n == 2; }));
199 a = [];
200 [1, 2].every(function() { a.push(this); return true; }, "");
201 assertTrue(a[0] !== a[1]);
204 a = [];
205 [1, 2].every(function() { a.push(this); return true; }, {});
206 assertEquals(a[0], a[1]);
209 a = [];
210 [1, 2].every(function() { 'use strict'; a.push(this); return true; }, "");
211 assertEquals("", a[0]);
212 assertEquals(a[0], a[1]);
220 var a = [0,1,2,3,4];
224 assertArrayEquals(result, a.map(function(n) { return n + 1; }));
225 assertEquals(a, a);
230 assertArrayEquals(result, a.map(function(n) { return this.delta + n; }, o));
233 a = [0,1,2,3,4];
236 a.map(function(n, index, array) {
239 assertArrayEquals(result, a);
243 a = [0,1,2,3,4];
246 a.map(function(n, index, array) { array.push(n); return n + 1; }));
247 assertArrayEquals([0,1,2,3,4,0,1,2,3,4], a);
250 a = new Array(20);
251 a[15] = 2;
252 a = a.map(function(n) { return 2*n; });
253 for (var i in a) assertEquals(4, a[i]);
257 a = [];
258 [1, 2].map(function() { a.push(this) }, "");
259 assertTrue(a[0] !== a[1]);
262 a = [];
263 [1, 2].map(function() { a.push(this) }, {});
264 assertEquals(a[0], a[1]);
267 a = [];
268 [1, 2].map(function() { 'use strict'; a.push(this); }, "");
269 assertEquals("", a[0]);
270 assertEquals(a[0], a[1]);
278 var a = [0,1,2,3,4];
281 assertTrue(a.some(function(n) { return n == 3}));
282 assertFalse(a.some(function(n) { return n == 5}));
286 a = [1,42,3];
287 assertTrue(a.some(function(n) { return this.element == n; }, o));
288 a = [1];
289 assertFalse(a.some(function(n) { return this.element == n; }, o));
292 a = [0,1,2,3];
294 a.some(function(n, index, array) {
296 assertArrayEquals([1,2,3,3], a);
299 a = [0,1,2];
301 a.some(function(n, index, array) { array.push(42); return n == 42; }));
302 assertArrayEquals([0,1,2,42,42,42], a);
305 a = new Array(20);
307 a[2] = 42;
308 a[10] = 2;
309 a[15] = 42;
310 assertTrue(a.some(function(n) { count++; return n == 2; }));
315 a = [];
316 [1, 2].some(function() { a.push(this) }, "");
317 assertTrue(a[0] !== a[1]);
320 a = [];
321 [1, 2].some(function() { a.push(this) }, {});
322 assertEquals(a[0], a[1]);
325 a = [];
326 [1, 2].some(function() { 'use strict'; a.push(this); }, "");
327 assertEquals("", a[0]);
328 assertEquals(a[0], a[1]);