In Chrome, the following
console.log(true, '\t');
will print
true " "
Why do quotation marks exist?
(Note that it console.log(true + '', '\t')will print only true, just as it console.log('a', '\t');will print only a.)
console.log(true + '', '\t')
true
console.log('a', '\t');
a
There are basically two overloads for console.log:
console.log(formatString, args)and console.log(arg1, arg2, ...).
console.log(formatString, args)
console.log(arg1, arg2, ...)
More specifically, for the source code , if the first parameter is a string, then it treats it as a format string for other parameters. Otherwise, each parameter is output directly.
, console.log(true + '', '\t') "true", , \t -, console.log(true, '\t') , true .
\t
console.log(true, '\t')
console.log(true, '\t'); true " "
console.log(false, '\t'); false " "
, , false , true o_O... , \t
console.log('\t', true); true
, , , , , .
console.log(false, '\t', '\t'); false " " " "
, , , , , . , Google Chrome? , .