DEV Community

Cover image for Display Messages in Browser Console using Figlet
Adnan Afzal
Adnan Afzal

Posted on

Display Messages in Browser Console using Figlet

Here how you can display beautiful messages in a browser console using Javascript. You just need to download a library called Figlet.

After download, you need to extract the zip file and copy the file lib/figlet.js in your project. You also need to copy the fonts folder too.

Then you need to include that library in your project using the script tag:

<script src="figlet.js"></script>
Enter fullscreen mode Exit fullscreen mode

Right after that, you can display the message you want in the browser console:

<script>
    // initialize the library

    const textDisplay = "adnan-tech.com";
    const font = "Speed";

    figlet(textDisplay, font, function (error, text) {
        // display the text in console
        console.log(text);
    });
</script>
Enter fullscreen mode Exit fullscreen mode

Top comments (0)