The issue is that there is an element on that page with id="copy". If you type copy in the console, you should get a element printed out like this:

$ copy
<g id="copy"></g>

So, you'll have to remove that element before using the copy function:

document.querySelector('#copy').remove();

Running it in console again should show it's a function:

$ copy
ƒ copy() { [native code] }

Then use copy() as normal, e.g. copy(myVariable)

 

来源:https://stackoverflow.com/questions/62212958/devtools-console-copy-is-not-a-function-while-on-youtube