In the console of Chrome you can write pretty nice stuff these days. Checkout this link. I've also made a screenshot:
As you can see in the screenshot too, the file name / line number (VM298:4
) is written at the right. Is it possible the remove that, because in my case this is a very long name and more or less breaks the effect I'm trying to make in my console ?
Type it and press Ctrl+Alt+W + W . Another way to console. log your variables is to simply place your mouse cursor on them and then wrap them on the line below with Ctrl+Alt+W + Down or the line above with Ctrl+Alt+W + Up .
js, console. log() method is used to display the message on the console. By default, the console. log() method prints on console with trailing newline.
After typing out the first line, instead of hitting enter, hit shift + enter. This will bring you the next line without executing the code.
The console. log() is a function in JavaScript which is used to print any kind of variables defined before in it or to just print any message that needs to be displayed to the user. Syntax: console.
To keep your logging statements clean, you could define the following function and simply use console.print
to log without filename/line numbers:
// console.print: console.log without filename/line number
console.print = function (...args) {
queueMicrotask (console.log.bind (console, ...args));
}
console.print
takes the same arguments as console.log
for example:
console.print("Text with no filename info.")
console.print('%c Custom CSS and no line numbers! ', 'background: #555555; color: #00aaff');
Another option is to give your source script files shorter names using sourceURL
//# sourceURL=new_file_name.js
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With