Timeline for What is console.log?
Current License: CC BY-SA 3.0
24 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 29, 2019 at 11:30 | comment | added | Gilberto B. Terra Jr. | Some tips: You can use colors to have a better view of: console.log('%c Sample Text', 'color:green;'); Or add some VAR in the text using: console.log(`Sample ${variable}`, 'color:green;'); | |
| S Sep 9, 2017 at 22:36 | history | suggested | user5393970 | CC BY-SA 3.0 |
Remove link to SO documentation (see https://meta.stackoverflow.com/q/356294/5393970 )
|
| Sep 9, 2017 at 21:52 | review | Suggested edits | |||
| S Sep 9, 2017 at 22:36 | |||||
| May 23, 2017 at 12:03 | history | edited | URL Rewriter Bot |
replaced http://stackoverflow.com/ with https://stackoverflow.com/
|
|
| Apr 30, 2017 at 15:53 | comment | added | Jan Hančič | @Mac original version of the question asked about jQuery, it since got edited out (not sure why) by other people. So that is why. | |
| Apr 29, 2017 at 15:03 | comment | added | Mac | The OP does not mention jQuery, and since you explain console.log is "not a jQuery feature," then why clutter the answer by including things it's not? | |
| Feb 17, 2017 at 1:37 | history | edited | castletheperson | CC BY-SA 3.0 |
fixed code formatting
|
| Jul 23, 2016 at 14:02 | history | edited | nicael | CC BY-SA 3.0 |
added 118 characters in body
|
| May 14, 2015 at 9:03 | history | edited | Luke Girvin | CC BY-SA 3.0 |
Fix typo
|
| Oct 22, 2014 at 4:12 | review | Suggested edits | |||
| Oct 22, 2014 at 5:32 | |||||
| Jul 31, 2014 at 6:48 | comment | added | Sandro L | IE drives me nuts, he did not run the whole script (because of console.log in between). But when I opened the console to see what's wrong, everything seemed fine. Reason: console.log now works (until the browser is restarted) ... So thanks for the tip with if(window.console && window.console.log ) and censored IE! | |
| Jun 17, 2013 at 10:39 | comment | added | farid bekran |
also can use like this.... var variable = 12; console.log("variable value equal to %d", variable)
|
|
| Jan 9, 2013 at 20:28 | history | edited | Jan Hančič | CC BY-SA 3.0 |
added 25 characters in body
|
| Jul 3, 2012 at 7:16 | vote | accept | Mihir | ||
| Jan 12, 2011 at 6:31 | history | bounty awarded | Mihir | ||
| Jan 11, 2011 at 18:10 | comment | added | Tgr |
if (console.log) (or even if (console && console.log)) will still throw an error if console is not available. You should use window.console (as window is guaranteed to exist) and only check one depth level at one time.
|
|
| Jan 11, 2011 at 18:07 | comment | added | Enrico Carlesso | Imho, better than checking every time if console.log is available is better to have something like this:if(typeof(console) == 'undefined') { console = {'log': function() {return}} } In such case you can write console.log every time you need without checking the presence of it! | |
| Jan 10, 2011 at 16:44 | comment | added | Alan Whitelaw | it's also useful for not letting IE throw an error for console not being defined | |
| Dec 27, 2010 at 16:44 | comment | added | AbdullahC | @Jan: I see. I assumed the if condition was to hide it (as an alternative to deleting the line), rather than avoid a null error (as an alternative to commenting it out). | |
| Dec 27, 2010 at 16:30 | comment | added | AbdullahC | "This is useful as you don't have to remove your debugging code when you deploy to production" <-- What if an end-user opens Firebug? | |
| Dec 27, 2010 at 16:02 | comment | added | RobertPitt | Google Chrome's Developer tools also has a console integrated. | |
| Dec 27, 2010 at 14:23 | history | edited | Jan Hančič | CC BY-SA 2.5 |
added 335 characters in body; added 36 characters in body
|
| Dec 27, 2010 at 14:19 | history | edited | Paul D. Waite | CC BY-SA 2.5 |
added 70 characters in body
|
| Dec 27, 2010 at 14:14 | history | answered | Jan Hančič | CC BY-SA 2.5 |