Recently, I noticed something amazing in Facebook console when I pressed “Ctrl+Shift+J” (Developer tools) as shown in below image.
As we can see, text “Stop” has bigger font and red color followed by instruction which again has different style than normal console.log statements.
If Facebook can do it, then we can. When I tried to investigate, came to know that we can apply style in console.log and supported by Google Chrome and Mozilla. It can be done using below syntax
- %c%s – placeholder saying CSS and string will be passed
- style – style to be applied in debug output
- debug text – actual text to be displayed