How to see the tab eol spaces in chrome console?
You can also use JSON.stringify
const data = 'name\tvalue\n'
console.log(JSON.stringify(data))
// "name\tvalue\n"
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.