Created
December 17, 2020 20:32
-
-
Save hoganlong/58e24a586aed882a02d4bc5eb7fba166 to your computer and use it in GitHub Desktop.
support for question https://stackoverflow.com/questions/65347745/print-rectangular-with-in-js/65347801?noredirect=1#comment115529360_65347801
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let Uxxankyun = { | |
a: 8, | |
b: 6, | |
draw: function(x) { | |
document.write("<pre>"); | |
if (x) { | |
for (let i = 0; i < this.a; i++) { | |
for (let j = 0; j < this.b; j++) { | |
document.write(" * ") | |
} | |
document.write(" <br> ") | |
} | |
document.write("<br>") | |
} else { | |
for (let i = 0; i <= this.a; i++) { | |
for (let j = 0; j <= this.b; j++) { | |
if (i == 0 || j == 0 || j == this.b || i == this.a || j == this.a) { | |
document.write("* ") | |
} else { | |
document.write(" "); | |
} | |
} | |
document.write("<br>") | |
} | |
} | |
document.write("</pre>"); | |
} | |
} | |
Uxxankyun.draw(false) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment