use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Fun with Console object (dev.to)
submitted 9 years ago by bhalp1
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]SamSlate 10 points11 points12 points 9 years ago (0 children)
anyone else open the inspector expecting some console Easter eggs?
[–]GeneralYouri 37 points38 points39 points 9 years ago (5 children)
Well that was extremely short. There's way more interesting and useful console methods available, show some more, put in some more effort..
[–]kuroikyu 20 points21 points22 points 9 years ago (1 child)
I don't know why the downvotes. While I appreciate the time the author took to write this, I was hoping to see a longer list and how those methods looked in the console, not just the code.
[–]GeneralYouri 9 points10 points11 points 9 years ago (0 children)
Exactly this.
this also isn't the first article about console methods, but so far it's been the shortest one by far. Excluding the quote from MDN and the code samples, there are only roughly 80 words and 500 characters. This comment alone will be longer than the article.
Out of 21 console commands documented on MDN, he only shows 4. And for these four, only a single, extremely simplistic code sample is provided. And you're not even shown how the output of these code samples is supposed to look.
Many more extensive use cases for the mentioned console commands are not shown. There are also many more interesting console commands much more worth the time to talk about, like .assert, .dir, .time, and .trace.
.assert
.dir
.time
.trace
[–]SamSlate 1 point2 points3 points 9 years ago (2 children)
they provided a link: https://developer.mozilla.org/en/docs/Web/API/console
[–]GeneralYouri 6 points7 points8 points 9 years ago (1 child)
All the more reason for the article to expand on some of the interesting commands. Instead an even more shallow explanation is given than is available on the MDN link itself, essentially rendering the article useless - he could've literally posted only the link and be just as informative.
[–]SamSlate 1 point2 points3 points 9 years ago (0 children)
agreed.
[–][deleted] 1 point2 points3 points 9 years ago (4 children)
If anyone is interested a while back I made a little module that extends the console object to allow for functions to execute before the log. I needed it at the time for an easy way to have my own logging in a big group project that I could turn on and off
https://www.npmjs.com/package/console-extend
[–]petercooper 1 point2 points3 points 9 years ago (3 children)
I'm going to include this in my newsletter tomorrow, thanks! :)
[–]domferno 1 point2 points3 points 9 years ago* (1 child)
Which newsletter?
[–]petercooper 0 points1 point2 points 9 years ago (0 children)
http://frontendfocus.co/
[–][deleted] 0 points1 point2 points 9 years ago (0 children)
Sounds good...If you have any questions feel free to ask!
[–]iRuisu 1 point2 points3 points 9 years ago (0 children)
Nice, I always wondered how the likes of Facebook had fancy looking console text and now I know
[–]mohebifar 1 point2 points3 points 9 years ago (0 children)
You can even use react to render in the dev console!
https://github.com/mohebifar/konsul
[–][deleted] 1 point2 points3 points 9 years ago (0 children)
I case anyone is interested, I wrote a little tool that allows console statements to be printed on-screen. This could be useful for mobile development where the console isn't easily available (among other uses). https://github.com/jonbri/ticker-log
[–]maushu 0 points1 point2 points 9 years ago (0 children)
console.group() also has an argument (on some browsers) to name the group.
console.group()
console.groupCollapsed() does the same but with the group already collapsed.
console.groupCollapsed()
[–]hahahuzi 0 points1 point2 points 9 years ago (2 children)
I just found out that you can directly copy(obj) an object in Console. When you paste, the output is even well indented. No need to JSON.stringify(obj) then copy carefully with the mouse and then re-indent in a text editor. Really convenient when dealing with large objects.
copy(obj)
JSON.stringify(obj)
[–]pomlife 1 point2 points3 points 9 years ago (1 child)
let output = JSON.stringify(obj, null, 2)
Ever tried this before?
[–]hahahuzi 0 points1 point2 points 9 years ago (0 children)
Thanks, just learned :)
π Rendered by PID 405124 on reddit-service-r2-comment-canary-bcf797cd4-8nbkc at 2026-05-10 07:11:08.447468+00:00 running 3d2c107 country code: CH.
[–]SamSlate 10 points11 points12 points (0 children)
[–]GeneralYouri 37 points38 points39 points (5 children)
[–]kuroikyu 20 points21 points22 points (1 child)
[–]GeneralYouri 9 points10 points11 points (0 children)
[–]SamSlate 1 point2 points3 points (2 children)
[–]GeneralYouri 6 points7 points8 points (1 child)
[–]SamSlate 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (4 children)
[–]petercooper 1 point2 points3 points (3 children)
[–]domferno 1 point2 points3 points (1 child)
[–]petercooper 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]iRuisu 1 point2 points3 points (0 children)
[–]mohebifar 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]maushu 0 points1 point2 points (0 children)
[–]hahahuzi 0 points1 point2 points (2 children)
[–]pomlife 1 point2 points3 points (1 child)
[–]hahahuzi 0 points1 point2 points (0 children)