[Solved] How to write desgin in console.log? [closed]


You can use \n character:

var str = "****************\n* Rohit Azad *\n****************";
console.log(str);

As per updates:

It seems very clear that you have to calculate the tabs,spaces,newlines etc to achieve that. My suggestion is to use multiline string with backticks which came in ecmascript version 6.

var str = `
           **********************
            *    Rohit Azad    *
           **********************
            ********************
              ***************
                  ******
                  ******
                   ****`;

console.log(str);

But remember this can’t be used with browsers currently, you can use some transpilers to convert it to es5 code but that won’t be accurate (i guess.)

Checkout this in action and look in browser’s console not the embedded one.

3

solved How to write desgin in console.log? [closed]