Create shortcut to console.log() in Chrome

Asked
Active3 hr before
Viewed126 times

3 Answers

consolecreate
90%

When I reported it, it was refused but the answer was simple - create the shortcut like this:,How can I make a shortcut to console.log, with Developer Tools showing the line number where log was called, rather than where the actual console.log call is located?, the best way I've seen. I want to add, that to disable logging for some function it is possible to write: const $=0; $ && log('hello javascript'); – Igor Fomenko Aug 4 '20 at 17:33 , Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers

When I reported it, it was refused but the answer was simple - create the shortcut like this:

var log = console.log.bind(console);
load more v
88%

Turbo Console Log provides another convenient shortcut to create those console.logs., Extras: Removing All console.log() ,In addition to creating console.log() messages quickly, Turbo Console Log can:,In our most recent stream, we started talking about my VS Code extensions and one that was recommended to me that I'd never heard of before was Turbo Console Log.

The JavaScript (ES6 Code Snippets) extension has a convenient snippet where you can type:

// snippet activation 
clg

// expands to
console.log()
72%

This tool can be used to tell you where you are in your code. I personally like to call it when I load my document with a cute little welcome message for myself.,There are a lot of other things you can do with debugger, but identifying objects and variables is one of the most basic and helpful tools to have in your arsenal.,console.log() is a JavaScript function that prints out an input to the console. You can call this function basically anywhere in your code, and when it executes you’ll see the output in your Dev console. This function acts upon the console, not the document or window, so your chosen input will not appear on your window at all. It’s for your own private view.,Using console.log() like this ensures that you know when your functions begin and end. For such a small function it may seem like overkill, but once you begin working with complex functions, conditionals, and callbacks, you’ll appreciate having these indicators to guide you.

This tool can be used to tell you where you are in your code. I personally like to call it when I load my document with a cute little welcome message for myself.

console.log('The DOM has loaded! Welcome to your app, master!') console.log('★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★')
load more v

Other "console-create" queries related to "Create shortcut to console.log() in Chrome"