Javascript TypeError ____ is not a function

后端 未结 4 1662
野性不改
野性不改 2021-01-27 02:46

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

4条回答
  •  庸人自扰
    2021-01-27 03:26

    querySelector/All returns a NodeList not an array, so those functions are not available.

    You can use call to use those array methods though

    [].splice.call(opp,0,1);
    

    The first argument is the execution context that the function will use, all other arguments are the arguments that will be passed to the function

    Function call reference

提交回复
热议问题