-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbucle_texto.js
93 lines (70 loc) · 1.59 KB
/
bucle_texto.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/* eslint-disable no-alert, no-console, no-undef */
var outText = "";
for(var c = 0;c<7;c++)
{
outText += "#";
console.log(outText);
}
return;
var rectangle =
"\n" +
"\n" +
"\n" +
"\n" +
" **********\n" +
" * *\n" +
" * *\n" +
" * *\n" +
" * *\n" +
" **********\n";
console.log(rectangle);
function indentation(indent) {
var result = "";
for (var i = 0; i < indent; i++) {
result += " ";
}
return result;
}
var rectangle2 =
"\n" +
"\n" +
"\n" +
"\n" +
indentation(10) + " **********\n" +
indentation(10) + " * *\n" +
indentation(10) + " * *\n" +
indentation(10) + " * *\n" +
indentation(10) + " * *\n" +
indentation(10) + " **********\n";
console.log(rectangle2);
function indentedRectangle(indent)
{
var rectangleIndented =
"\n" +
"\n" +
"\n" +
"\n" +
indentation(indent) + " **********\n" +
indentation(indent) + " * *\n" +
indentation(indent) + " * *\n" +
indentation(indent) + " * *\n" +
indentation(indent) + " * *\n" +
indentation(indent) + " **********\n";
return rectangleIndented;
}
function wait(millis)
{
var now = Date.now();
const limit = now + (millis);
while(now < limit)
{
now = Date.now();
}
}
console.clear();
for(var loops = 0;loops<20;loops++)
{
console.log(indentedRectangle(loops));
wait(500);
console.clear();
}