-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathscript.js
More file actions
75 lines (64 loc) · 1.31 KB
/
script.js
File metadata and controls
75 lines (64 loc) · 1.31 KB
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
" use strict ";
var display = document.getElementById("display");
function oneToTen(){
for (i = 1; i <= 10; i++) {
display.innerHTML += i + "<br>";
}
}
function oddNumbers(){
for (i = 1; i <= 20; i+=2) {
display.innerHTML += i + "<br>";
}
}
function squareNumbers(){
for (i = 1; i <= 10; i++) {
display.innerHTML += i * i + "<br>";
}
}
function random4(){
var result;
for(i = 1; i <= 4; i++){
result = Math.round(Math.random() * 99) + 1;
display.innerHTML += result + "<br>"
}
}
function even(n){
for (i = 2; i < n; i+=2) {
display.innerHTML += i + "<br>";
}
}
function powers(n){
for (i = 1; i <= n; i++) {
display.innerHTML += Math.pow(2,i) + "<br>";
}
}
function thereYet(){
var quit = "no";
while(quit != "yes"){
quit = prompt("Are we there yet?");
}
}
function triangle(n){
for (i = 1; i <= n; i++) {
for(j = 1; j <= i; j++){
display.innerHTML += "*";
}
display.innerHTML += "<br>";
}
}
function tableSquare(){
for (i = 1; i <= 4; i++) {
for(j = 1; j <= 4; j++){
display.innerHTML += i * j + "| ";
}
display.innerHTML += "<br>";
}
}
function tableSquare(n){
for (i = 1; i <= n; i++) {
for(j = 1; j <= n; j++){
display.innerHTML += i * j + "| ";
}
display.innerHTML += "<br>";
}
}