New line in Javascript or HTML?

var symbol = prompt("Please choose a symbol");
var side = prompt("Choose the length of the square");
var count1 = 1;
var count2 = 1;
while (count1 <= side) {
    while (count2 <= side) {
        var count2 = count2 + 1;
    var count2 = 1;
    var count1 = count1 + 1;

I am working with the code above. I'm trying to get JS to draw a box out of a given input. I have read about the \n\r and
codes but I have not be able to place them somewhere to get the lines to form a square. For instance if I input * and 3. I want output to be:


But it's appearing as *** *** ***.

Where can I include these tags, and should it be done in HTML or JS?



Use a <br> tag for a break. The \r or \n are line breaks, but HTML ignores most whitespace.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us Javascript

©2020 All rights reserved.