forked from code-differently/JavaScript-Loops-Lab
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathindex.js
More file actions
57 lines (43 loc) · 954 Bytes
/
index.js
File metadata and controls
57 lines (43 loc) · 954 Bytes
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
for (let i = 1; i < 11; i++) {
console.log(i);
}
for (let i = 1; i < 11; i++) {
console.log(i * i);
}
for (let i = 2; i < 20; i += 2) {
console.log(i);
}
let n = Number(prompt("Pick a number:"));
let m = Number(prompt("Pick another number:"));
let total = 0;
for (let i = n; i < m; i++) {
total += i;
}
console.log(total);
let answer = "Yes";
let userAns = prompt("Are we there yet?");
while (answer != userAns) {
userAns = prompt("Are we there yet?");
}
alert("Good!");
for (let i = 1; i < 6; i++) {
let output = "";
for (let j = 1; j <= i; j++) {
output += "*"
}
console.log(output);
}
for (let i = 1; i < 5; i++) {
let output = "| ";
for (let j = 1; j <= 4; j++) {
output += i * j + " | "
}
console.log(output);
}
for (let i = 1; i < 7; i++) {
let output = "| ";
for (let j = 1; j <= 6; j++) {
output += (i * j) + " | ";
}
console.log(output);
}