why does console.log not output in chrome?

后端 未结 3 1379
孤城傲影
孤城傲影 2021-01-21 02:28

Recently I read a query about \"What does console.log do\" and I read an answer, tried using it and found that despite the answer stating that it outputs to the console in googl

相关标签:
3条回答
  • 2021-01-21 03:07

    Press F12 and look at in Developer Tools: Console. I tried your code just now, works fine for me -- Chrome version 30.0.

    Since you're after console logging, not mathematical logarithms, perhaps you could stop going on about there being similarly-named function in the Math object. It's not relevant here whatsoever.

    You're also coming across just a little shouty. console.log() works fine, and your question didn't indicate that you knew where to look. This is totally your problem, but I'm trying to help you. I can obviously only go on the information you provide, and I can't say your initial question was written very clearly.

    It appears, since the snippet of code you posted works here absolutely fine, that your calling code & containing (which you haven't posted) would be the cause of the problem. You should debug these, to find out what's going wrong.

    Do you know how to use the Chrome debugger? Are there any error messages showing in Chrome or on the console?

    Test it on a simple page if necessary, to rule out other errors in the page/ or surrounding context breaking it. One common mistakes is declare functions in a jQuery ready handler or similar, and then try & access them globally. Make sure your logging function is actually global (outside any other function(){} or object {} blocks).

    Lastly, it's good to have a logging function for portability (I have one myself) but put() is not a good name for it. Naming it consoleLog() or log() would be better.

    0 讨论(0)
  • 2021-01-21 03:22

    Make sure that in the Developer Tools the Filter in the console section is set to All or Logs...

    I had a similar experience where I couldn't see any of my console.log output and it was because the console was set to filter on Errors only... All the log entries were there - they just weren't visible.

    Bonus marks: you can also Ctrl + Click to select multiple filters (Errors + Logs for example).

    0 讨论(0)
  • 2021-01-21 03:33

    Had the same issue .

    Make sure your using de right path when you try import thing's .

    Example whit my issue :

    Wrong path ----> ** import normalizedData from 'normalizr'; **

    Right path ---> ** import normalizedData from '../schemas/index.js'; **

    0 讨论(0)
提交回复
热议问题