forked from galvanizejs/prep-week2-project1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
176 lines (67 loc) · 4.12 KB
/
main.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
/*
=======================================================
** Week 1 - Project 2 **
Below are a number of problems for you to solve
using JS. The JS code can be written below each
problem.
=======================================================
*/
// 1. Connect the main.js document to the HTML page.
// Then Update the Text to Green by adding the .status-good class.
// When the JS is connected properly, the following code will update the status message.
document.getElementById("q1").innerHTML = "JS Page Connected Properly!";
document.getElementById("q1").classList.add("status-good");
// 2. Declare a new variable called 'feelings',
// Then store a string with a word that describes
// how well you feel about this course material.
// Then display that string within the HTML page.
// 3. Declare a new variable called 'name',
// store your name within it, and then
// create a 'message' variable with a greeting,
// concat the message and name variables
// and then display it within the HTML page.
// 4. Declare two variables with number values.
// Add, subtract, multiply and divide them.
// Display the values of each within the HTML page.
// Then label these values the best you can.
// 5. Declare two variables with string values.
// Create a third variable that concatenates the two strings
// that also places the appropriate space between the strings.
// Display the value of the third variable within the HTML page.
// 6. Add, subract, multiply and divide the strings '5' and '3'.
// Observe the results and brieftly explain the results within the HTML page.
// 7. When a button is clicked, add content into the ID "q7".
// 8. Collect a number value from the user and when a button is clicked,
// then double user's answer and display that value into the HTML page.
// 9. Set the variable 'num1' to 5.
// Set the variable 'num2' to 10.
// Test to see if num1 is greater than num2.
// If so, output to the HTML page: Yes, the value of num1 is greater than num2
// If not, output to the HTML page: No, the value of num1 is not greater than num2
// 10. Set the variable 'score' to a number between 1-100.
// Create the following conditions:
// If the score is above 90, output to the HTML page "Great job".
// If the score is between 60 and 89, output to the HTML page "Nice work, keep practicing".
// If the score is below 59, output to the HTML page "Very bad: study more and retake the test".
// Test to make sure each condition is met properly.
// ADVANCED TRACK
// A. Ask for a user's name, age and city using input fields.
// In a single command, take the user's answers and display into the HTML page the sentence:
// "My name is __. I'm __ years old, and I live in __."
// B. Create the formula to determine the area of a rectangle.
// The rectangle is: 2 inches by 3 inches
// Display the result in the HTML page.
// C. Collect the use's length and width input to determine the area of a rectangle and display within the HTML page the result.
// D. Have the user enter their name into a textfield. When they click a button, find the length (number of characters) of their name and display the result in the HTML page.
// E. Create a textfield to request a test score between 0-100 from the user.
// If the score is above 90, display in the HTML a message to tell the user "Great job!".
// If the score is between 60 and 89, display a message of "Nice work, keep practicing.".
// If the score is below 59, display a message of "Very bad: study more and retake the test.".
// You can get fancy by adding CSS styles to each of these displays to change the color, too - Green=Good, Orange=OK, Red=Bad
/* SANDBOX TRACK
Solving all of these problems is a great step in the right direction,
but the next step is coming up with your own arrangements to solve
new problems. Practice creating your own problems to solve and their solutions -
you can even challenge your classmates!
Also, consider how you can add/remove CSS styles to create added presentation with the results.
*/