I am currently using the Chrome console to do some debugging for a Greasemonkey script.
From the console I run var opp = document.querySelectorAll(\'a[class=\"F-re
First,
Array.prototype
, although it is intentionally generic so can be called on other Arraylike objectsthis
via call or applysplice
needs to be able to assign on it's this
, which will fail for a NodeList as you will get the following TypeError: Cannot set property length of # which has only a getter
this
will work on a NodeList, e.g. slice, map, indexOf, forEach, filter, some, every, etc..Now we are in a position to do something,
Array.prototype.slice
splice
on this object insteadSo,
var opp = document.querySelectorAll('a[class="F-reset"]'); // NodeList
oop = Array.prototype.slice.call(oop); // Array
// ...
oop.splice(0, 1);