javascript - why is there a space after console logging with a backslash n? -
the content after new line character seems start indent of 1 space.
console.log('foo\n', 'bar');
this logs:
foo bar
why isn't bar directly below foo? how log text starting @ same point of line?
when using console.log('foo', 'bar');
, automatically adds space between 2 logs. if want exclude space, use this:
console.log('foo', '\nbar');
it interpret new line without white space.
Comments
Post a Comment