This is pretty simple to do. You will need to use setTimeout
with a console.log.bind
:
setTimeout (console.log.bind (console, "This is a sentence."));
And if you want to apply CSS or additional text to it just add add %c
or any other %
variable:
setTimeout (console.log.bind (console, "%cThis is a sentence.", "font-weight: bold;"));
var css = "text-decoration: underline;";
setTimeout (console.log.bind (console, "%cThis is a sentence.", css));
Note that this method will always be placed at the end of the log list. For example:
console.log ("Log 1");
setTimeout (console.log.bind (console, "This is a sentence."));
console.log ("Log 2");
will appear as
Log 1
Log 2
This is a sentence.
instead of
Log 1
This is a sentence.
Log 2
I hope this answers your question.
console.group()
. – Consanguinity