Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why does console.log not output in chrome?

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 googles browser, I just tried it and I get no output.

I did try this code:

function put(p){
if ( window.console && window.console.log ) {
        console.log(p); // console is available
    }else{
        alert(p);
    }
}

BUT... I get neither console output or alert and furthermore .log is a Math property, what gives with that?

like image 730
Mark Giblin Avatar asked Dec 25 '22 18:12

Mark Giblin


1 Answers

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).

like image 106
Boycs Avatar answered Jan 21 '23 08:01

Boycs