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.
- Add %c before the text you want to style.
- 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
console.log(`I LOVE π %c${name}`, 'color: red; font-size: 50px')
will produce
console.log(`%cI LOVE π %c${name}`, 'color: red; font-size: 50px')
will produce
If you liked this, please let me know in the comment.
Thanks,
CapsCode
Β