Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="">
<title>Whaddup</title>
<script src="index.js"></script>
</head>

<body>

</body>

</html>
57 changes: 57 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,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?");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps a do while here?

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++) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be consistent with your stop values. Both i<7 and <i<=6 are fine but both loops should use the same value

let output = "| ";
for (let j = 1; j <= 6; j++) {
output += (i * j) + " | ";
}
console.log(output);
}