Here is a message I see about the issues tab:
Some problems no longer generate console messages, but are surfaced in the issues tab. Click to view 1 possible improvement.
Blockquote
Does anyone know what the problem is here? I can console.log everywhere EXCEPT within a function. But this doesn’t work:
function why() {
console.log('WHY');
}
It has to have something to do with Chrome. I can keep going along with what I am working on without checking my output in the console, but I would like to know why something like this would happen.
Also, in researching this I did something and now the console doesn’t clear after each page reload. How do I fix that? Same in Firefox. I think it may be VS Code.
Something tells me you can’t use fetch like that to open a local file on your computer, so I’m guessing that fetch is throwing an exception and thus the console.log is never being executed.
If you want to access local files from a web page then you should look into the FileReader API.
If you are having trouble getting console.log to work in other places I think I would need more information, perhaps you could give us a link to the project?
Yeah, if it is one of your files that you want to open, then I think you should just import it at writing time, or put it on an API. As this is, the browser assumes that you are trying to open a file on the end user’s computer (where your app would run) so it sees that as a huge security risk.
I’ve already done that - plus didn’t you see the 2nd function? I got another error working on in the same file - an error in the console telling me that data.forEach is not a function. I have no idea what is going on but something is…
The second function seemed to me to be the one I quoted. But that has nothing to do with an error for forEach as far as the code you provided would reveal.
In that case, the console.log can’t have been inside the function, maybe there were multiple console.logs. A block of code inside a function will never run unless you call the function.
I recently added parcel-builder which added a bunch of node modules. That’s the only thing I can think might do it. I now see “Watch Sass” at the bottom of VS Code. Everything is messing up
My console won’t clear after each reload.
Getting text to output to the DOM using fetch won’t clear off the page after each reload.
the forEach error…
Here is the code that fetches the array from a file called users.json: