javascript - Making "*" and space the same size -


this question has answer here:

i preparing little project people being new developing. includes html stuff, should make forms rectangles or triangles javascript. forms supposed "drawn" "*". since going introduce   element , simple , if-constructs, want them create rectangle looks this:

* * * *   * * *  * * * *  * * *  * * * * 

in different size.

i can imagine code looking this:

for (j = 0; j < 10; j++) {    (i = 1; <= 20; i++) {      if (j % 2 == 1) {        if (i % 2 == 1) {          document.write("*");        } else {          document.write("&nbsp;");        }      } else {        if (i % 2 != 1) {          document.write("*");        } else {          document.write("&nbsp;");        }      }    }    document.write("<br/>");  }

since i've tried out, wondering, in html "*" , space not have same size. looking command make same size (since know there one), can't find it.

it's not javascript issue @ all.

you have use monospace fonts. group of fonts has same pixel width every character.

read more here: https://en.wikipedia.org/wiki/monospaced_font


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -