-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
112 lines (84 loc) · 2.47 KB
/
script.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
function whoWillWin() {
document.write("Which Turtle will win?")
}
function button1Function() {
alert("You Lost!");
}
let button1 = document.getElementById("button1");
button1.addEventListener("submit", button1Function);
function button2Function() {
alert("You Lost!");
}
let button2 = document.getElementById("button2");
button2.addEventListener("click", button2Function);
function button3Function() {
alert("You Won WOOOOO!");
}
let button3 = document.getElementById("button3");
button3.addEventListener("click", button3Function);
function username() {
let username = prompt("Identify yourself!");
console.log("username", username);
while (!username) {
username = prompt("You are running out of time, reveal yourself" + "!")
console.log("We are in the While statement");
if (username) {
document.write("Welcome to the Turtle Races " + username + "! ");
}
}
};
function repeatImage(){
let userAmount = prompt ("How many racing turtles are there?")
for (let i=0; i < userAmount; i++){
document.write('<img id="image4" src="img/Turtle4.gif" alt="Racing turtles"/>')
}
}
// document.body.appendChild(img);
// let image = prompt('There are between 1 and 5 racing turtles how many do you think there are?')
// for( let i=0; i<=5; i++) {
// if
// console.log('racing turtle')
// }
// if (!username) {
// console.log("we are in the second if statement");
// // alert("GO AWAY" + "!");
// }
// while loop
//let x = 10;
//x=15;
// x=x + 5; // 20
// x++; // 21
// x+= 10; // 31
//console.log(x);
//while(condition is true){execute this code}
// let x=0
// while (x<10){console.log(x)
//x++;
//}
//FOR LOOP
// for(inital value; condition to evaluate, increment){
// code to execute
//}
// for(let i=0; i<=16; i++{
//console.log('hello student')
// if (i % 5 ==0){
// console.log('divisible by 5!');
//}
//}
//LOGICAL AND
// let x=5
// let y='5'
// console.log((x<10) &&(y ==5));
//
//EXAMPLE
//let myNumber =5
// for (let i=0; i < myNumber; i++){
// document.write('<p style='color:blue;'>Hello</p>')
//}
// function repeatImage() {
// let userNumber = prompt("How many times do you want to see griffey on the couch?");
// userNumber = parseInt(userNumber)
// for (let i = 0; i < userNumber && userNumber < 8; i++) {
// document.write('')
// }
// }