Skip to content

Instantly share code, notes, and snippets.

@samc
Created September 27, 2017 00:20
Show Gist options
  • Save samc/1c3f960e7e1917c589f50b47e7edece6 to your computer and use it in GitHub Desktop.
Save samc/1c3f960e7e1917c589f50b47e7edece6 to your computer and use it in GitHub Desktop.
var text;
for (var q = 1; q < 10; q++) {
for (var qq = 1; qq < 4; qq++) {
if (qq == 1) {
for (var a = 1; a < 10; a++) {
text += (a <= q) ? '*' : ' '
}
}
if (qq == 2) {
for (var b = 1; b < 10; b++) {
text += (b <= (10 -q)) ? '*' : ' '
}
}
if (qq == 3) {
for (var c = 1; c < 10; c++) {
text += (c >= q) ? '*' : ' '
}
} else {
for (var d = 1; d < 10; d++) {
text += (d >= (10 - q)) ? '*' : ' '
}
console.log(text);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment