Can you style console.log() in JavaScript

Can you style console.log() in JavaScript

style console.log() in javascript

Β·

1 min read

Hello Devs,

Is it possible to style cosole.log() in JavaScript ? Its YES.

Have you ever tried this ? If No, then lets do it together in these 2 simple steps.

  1. Add %c before the text you want to style.
  2. Insert one more argument in the console log function with the style you want to apply.

Do Checkout some of these examples:

console.log(`I LOVE πŸ’œ %c${name}`, 'color: green')

will produce

1.JPG

console.log(`I LOVE πŸ’œ %c${name}`, 'color: red; font-size: 50px')

will produce

2.JPG

console.log(`%cI LOVE πŸ’œ %c${name}`, 'color: red; font-size: 50px')

will produce

3.JPG

If you liked this, please let me know in the comment.

Thanks,

CapsCode

Β