I receive some data after a jQuery $.get
and I would like to be able to see all the non visible characters like spaces, tabs, end of line or new line. Is it possible to see this in chrome console? How?
Console Logs in Chrome: In Google Chrome, the Console Logs are available as a part of Chrome Dev Tools. To open the dedicated Console panel, either: Press Ctrl + Shift + J (Windows / Linux) or Cmd + Opt + J (Mac).
Use the short cut Ctrl + L to clear the console. Use the clear log button on the top left corner of the chrome dev tools console to clear the console.
The clear() method clears the console. The clear() method also write "Console was cleared" in the console.
One way would be to a manual replace for all possible whitespace characters:
var html = '\n\t';
console.log(html); // displays whitespace
console.log(html.replace(/\n/g,'\\n').replace(/\t/,'\\t')); // displays '\n\t'
Quite tedious, I know.
You can also use JSON.stringify
const data = 'name\tvalue\n'
console.log(JSON.stringify(data))
// "name\tvalue\n"
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