Whatever the IDE I’m currently using, I always end up creating a couple of handy snippets, such as the one I’ve shared on how to create a TODO template in VS Code. Here’s another handy one…
Say I’m troubleshooting some JavaScript/TypeScript code such as the one below:
Many times, I want to write out the contents of something to the console. Say, the contents of “this.week” in the example above. I’d end up writing something like this:
Except that it bothers me having to write this same kind of thing over and over again. Snippets to the rescue! I created the following snippet for me:
Now, all I have to do is to select the thing I want to print out (“this.week”), copy it into the clipboard, and then invoke the snippet in the code editor with “clogc” (as in “console.log clipboard”):
Like it? Share it with your team and friends!