Preparation Code Preparation HTML (this will be inserted in the <body>
of a valid HTML5 document in standards mode) (useful when testing DOM operations or including libraries) <script src ="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" >
</script >
<script src ="//documentcloud.github.com/underscore/underscore-min.js" >
</script >
<script >
var pi = Math .PI ,
a = new Array (1000 ),
cxt = {value :Math .floor (Math .random ()*1000 )},
self = cxt,
o,
e,
r;
var f_each = function (a, fn ) {
for (var i = 0 , l = a.length ; i < l; i++) {
fn (a[i], i);
}
return a;
}
</script >
Setup JS
Teardown JS
Test cases
Test #1 Title *
Async
Code * r = $.each (a, function (i, it ) {
o = it;
e = pi + o + self.value ;
});
Test #2 Title *
Async
Code * for (var item, i = 0 , len = a.length ; i < len; i++) {
o = a[i];
e = pi + o + self.value ;
};
r = a;
Title *
Async
Code * _.each (a, function (it, i ) {
o = it;
e = pi + o + this .value ;
}, cxt);
r = a;
Title *
Async
Code * var i = a.length ;
for (; i > 0 ; i--) {
o = a[i];
e = pi + o + self.value ;
};
r = a;
Title *
Async
Code * a.forEach (function (it, i ) {
o = it;
e = pi + o + this .value ;
}, cxt);
r = a;
Title *
Async
Code * r = f_each (a, function (it, i ) {
o = it;
e = pi + o + self.value ;
});
Title *
Async
Code * _.each (a, function (t, i ) {
return o = t;
});