console: log() static method
{{APIRef("Console API")}}
{{AvailableInWorkers}}
The console.log()
static method outputs a message to the console.
Syntax
console.log(val1)
console.log(val1, /* …, */ valN)
console.log(msg)
console.log(msg, subst1, /* …, */ substN)
Parameters
val1
…valN
- : A list of JavaScript values to output. A representation of each of these values is output to the console in the order given with some type of separation between each of them. There is a special case if
val1
is a string, which is described subsequently.
- : A list of JavaScript values to output. A representation of each of these values is output to the console in the order given with some type of separation between each of them. There is a special case if
msg
- : A JavaScript string containing zero or more substitution strings, which are replaced with
subst1
throughsubstN
in consecutive order up to the number of substitution strings. See Using string substitutions for a description of how substitutions work.
- : A JavaScript string containing zero or more substitution strings, which are replaced with
subst1
…substN
- : JavaScript values with which to replace substitution strings within
msg
. If there are more substitution values than there are substitution strings, the extra values are themselves written to the console after the detailed assertion message in the same manner as when there’s no format string.
- : JavaScript values with which to replace substitution strings within
See Outputting text to the console in the documentation of {{domxref("console")}}
for further details.
Return value
None ({{jsxref("undefined")}}
).
Specifications
{{Specifications}}
Browser compatibility
{{Compat}}