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 >
function arrayProtoSlice ( ) {
return Array .prototype .slice .apply (arguments );
}
function arrayLiteralSlice ( ) {
return [].slice .apply (arguments );
}
function splice ( ) {
return [].splice .call (arguments , 0 );
}
function push ( ) {
var x = [];
x.push .apply (x, arguments );
return x;
}
function unshift ( ) {
var x = [];
x.unshift .apply (x, arguments );
return x;
}
var bigArray = ((new Array (1000 )).join ("a," ) + "a" ).split ("," );
unshift.apply (null , bigArray).length === bigArray.length || alert ('unshift broken' );
push.apply (null , bigArray).length === bigArray.length || alert ('push broken' );
splice.apply (null , bigArray).length === bigArray.length || alert ('splice broken' );
arrayProtoSlice.apply (null , bigArray).length === bigArray.length || alert ('arrayProtoSlice broken' );
arrayLiteralSlice.apply (null , bigArray).length === bigArray.length || alert ('arrayLiteralSlice broken' );
</script >
Setup JS
Teardown JS