-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
122 lines (97 loc) · 3.1 KB
/
app.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
113
114
115
116
117
118
119
120
121
122
'use strict'
function generateGreeting(){
let firstName = getFirstName();
let message = timeOfDay();
return document.write('Hello ' + firstName + ', ' + message + '!');
}
function getFirstName(){
let firstName = prompt('What is your Name?');
return firstName;
}
function timeOfDay(){
let time = prompt('What hour is it (0-24?)');
let message = '';
if(time <= 11 && time > 0){
message = 'Good Morning!!';
} else if(time <= 18){
message = 'Good Afternoon!!';
} else if(time <= 24){
message = 'Good Evening!!';
} else{
message = 'Good Day!!';
}
return message;
}
function dePixelate(){
// let answer = prompt ('pick 1 or 2');
let image = '';
if (confirm('Do you want to see?')) {
image = '<img id="hero" alt="main image" src="https://mwbbcwxck32zpp124d9nlwip-wpengine.netdna-ssl.com/wp-content/uploads/2018/06/12173166_web1_summerguide-sea-180606-P1.jpg">'
} else {
image = '<img id="hero2" alt="main image" src="pixelated.jpg">'
}
return document.write(image);
}
// guess();
// function guess(){
// let answer=prompt("Guess how many fingers I am holding");
// if(answer=="3"){
// alert("correct");
// return;
// } else {
// alert("wrong answer");
// }
// guess();
// }
// function beachLoop(){
// let answer = prompt('How many secret beaches are there in Seattle?');
// while (answer != 149) {
// if (answer < 149) {
// alert ('more than that');
// } else {
// alert ('less than that');
// }
// answer = prompt('How many secret beaches are there in Seattle?');
// }
// alert ("that's correct!");
// }
function beachLoop2(){
let answer = '';
do{
answer = prompt('How many secret beaches are there in Seattle?');
if(answer < 100 ){
alert('more than that!');
} else if( answer > 200){
alert('less than that!');
} else if (answer == 149){
alert('CORRECT! The answer is 149!');
} else{
alert('Close! The answer is 149!');
}
}while(answer != 149)
console.log("Completed");
}
function forLoopSealPup(){
let answer = prompt('What is your rating? (1-5)');
let output = '';
for(let x = 0; x < answer; x++){
output += "<img class='sealpup' src='seal pup.jpeg'/>"
// output = output + "<img class='sealpup' src='seal pup.jpeg'/>"
}
// return document.write(output);
return document.getElementById('rating').innerHTML = output;
}
// function guess2(){
// let number = prompt("Guess how many fingers I am holding");
// if(number !== 3){
// prompt("incorrect. try again");
// } else {
// confirm("that is correct");
// }
// }
// function backgroundColor(){
// let color = prompt("What's your favorite color?");
// return document.body.style.backgroundColor = color;
// }
// how do i use a button for the seaPup function and display the images inside the page?
// how do i give the use a chance to cancel out of the loop?