why is console.log not working inside .each?

后端 未结 2 1810
庸人自扰
庸人自扰 2021-01-15 03:37

I tried doing the following:

$(\'.not-following\').each(function(i, obj) { 
      console.log(\'test\');
});

for some reason it keeps on pr

相关标签:
2条回答
  • 2021-01-15 03:56

    It isn't printing the object instead, what you are seeing is the jQuery (array of nodes) that the .each() function returns.

    The reason console.log() is not working is that Twitter has replaced the method with an empty function, as console.log in production is considered bad practice.

    If you need to access console.log you can delete the 'overridden' version that the Twitter developers have written by invoking:

    delete console.log
    

    The will default console.log back to it's original function.

    0 讨论(0)
  • 2021-01-15 04:11

    They overwritten console

    > console.log.toString()
    "function (){}"
    
    0 讨论(0)
提交回复
热议问题