Skip to content

Commit d74b2d2

Browse files
authored
Merge pull request devleagueprep#1 from kwhitejr/master
various edits
2 parents fac7345 + 6aa0e83 commit d74b2d2

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,5 @@
1010
- `$ cd js-logic`
1111
4. Open the js-logic assignment in sublime and write your code in the `exercises.js` file.
1212
5. From your terminal, use __node__ to test your code:
13-
- `node exercises.js` (don't forget to console.log your work)
14-
15-
16-
13+
- `node exercises.js` (don't forget to console.log your work).
14+

exercises.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
/*
22
If statements - Evaluates (or checks) a condition. If the condition is true, any statements in the subsequent code block are executed
33
*/
4+
var today = new Date();
45

56
if(today === "Friday"){
6-
return "Let's Party!";
7+
console.log("Let's Party!");
78
};
89

910
/*
1011
If/else statements = Evaluates (or checks) a condition. If the condition is true, the first code block is executed. If the condition is false, the second code block is executed instead.
1112
*/
1213

1314
if(today === "Friday"){
14-
return "Let's Party!";
15+
console.log("Let's Party!");
1516
}else{
16-
return "Get back to coding!";
17+
console.log("Get back to coding!");
1718
};
1819

1920

@@ -77,7 +78,7 @@ if(today === "Friday"){
7778
* @param Datatype: String `word`
7879
* @return Datatype: String
7980
*
80-
* The function will return the message "Word to Big Bird!", if the string passed into the function is a three letter word.
81+
* The function will return the message "Word to Big Bird!", if the string passed into the function is a three-letter word.
8182
* Console.log your result.
8283
*/
8384

@@ -91,7 +92,7 @@ if(today === "Friday"){
9192
* @param Datatype: String `second`
9293
* @return Datatype: String
9394
*
94-
* The function will return the message "You look mahvelous!", if the strings are equal, otherwise return the message: "I don't know who you are anymore."
95+
* If the strings are equal, the function will return the message "You look mahvelous!" Otherwise, return the message: "I don't know who you are anymore."
9596
* Console.log your result.
9697
*/
9798

@@ -105,7 +106,7 @@ if(today === "Friday"){
105106
* @param Datatype: String `second`
106107
* @return Datatype: String
107108
*
108-
* The function will return the message "Opposites do attract", if the strings are not equal, otherwise return the message: "Cause it's like you're my mirror."
109+
* If the strings are not equal, the function will return the message "Opposites do attract." Otherwise, return the message: "Cause it's like you're my mirror."
109110
* Console.log your result.
110111
*/
111112

@@ -118,7 +119,7 @@ if(today === "Friday"){
118119
* @param Datatype: Number `money`
119120
* @return Datatype: Boolean
120121
*
121-
* The function will return true if the number passed into the function is greater than 100, otherswise it will return false.
122+
* The function will return true if the number passed into the function is greater than 100, otherwise it will return false.
122123
* Console.log your result.
123124
*/
124125

@@ -146,7 +147,7 @@ if(today === "Friday"){
146147
* @param Datatype: Number `num`
147148
* @return Datatype: Boolean
148149
*
149-
* The function will return true if the number passed in is an even value, otherwise it will return false.
150+
* The function will return true if the number passed in is an even integer, otherwise it will return false.
150151
* Console.log your result.
151152
*/
152153

@@ -160,7 +161,7 @@ if(today === "Friday"){
160161
* @param Datatype: Number `age`
161162
* @return Datatype: String
162163
*
163-
* The function will return the message: "Welcome to the Legends Lounge." if BOTH values are over 21, otherwise it will return the message: "Chuck E Cheese is across the street."
164+
* If BOTH values are 21 or over, the function will return the message: "Welcome to the Legends Lounge." Otherwise, it will return the message: "Chuck E Cheese is across the street."
164165
* Console.log your result.
165166
*/
166167

@@ -174,7 +175,7 @@ if(today === "Friday"){
174175
* @param Datatype: Boolean `thesis`
175176
* @return Datatype: String
176177
*
177-
* The function will return the message: "Congratulations on a job well done." if EITHER the number value is greater than or equal to 120 or boolean value is true, otherwise return the message: "See you in summer school."
178+
* If EITHER the number value is greater than or equal to 120 or the boolean value is true, then the function will return the message: "Congratulations on a job well done." Otherwise, return the message: "See you in summer school."
178179
* Console.log your result.
179180
*/
180181

@@ -195,17 +196,18 @@ if(today === "Friday"){
195196
/*
196197
* #14
197198
* Function - buyDoughnut
198-
* Create a function named `buyDoughnut` which takes NO parameter.
199199
* Declare a variable named `budget` and assign it with a number value that is greater than 20.
200200
* Declare a variable named `doughnutPrice` and assign it with a number value that is greater than 0 but less than 6.
201201
* Declare a variable named `doughnutBought` and assign it with a number value of 0.
202202
*
203+
* Create a function named `buyDoughnut` which takes NO parameters.
203204
* When the function is invoked, the budget will be decreased by the doughnutPrice and doughnutBought will increase by 1.
204205
* Console.log budget and doughnutBought.
205206
* Invoke your function again.
206207
* Console.log budget and doughnutBought again.
207208
*/
208209

210+
209211
/*
210212
For loops - A for loop checks a condition a specific number of times and allows us to execute a code block and evaluate a condition to determine if our loop should run again.
211213
@@ -244,14 +246,14 @@ for (var i = 0; i<toyotaModels.length; i++){
244246
/*
245247
* #17
246248
* Function - sumItUp
249+
* Declare a variable named `numArray` and assign it with an array of 5 random numbers of your choice.
250+
* Declare a variable named `total` and assign it with a number value of 0.
251+
*
247252
* Create a function named sumItUp which takes a parameter: `arr`.
248253
*
249254
* @param Datatype: Array `arr`
250255
* @return Datatype: Number
251256
*
252-
* Declare a variable named `numArray` and assign it with an array of 5 random numbers of your choice.
253-
* Declare a variable named `total` and assign it with a number value of 0.
254-
*
255257
* The function will loop through and add up all the values in the array that is passed into the function and return the total.
256258
* Console.log your result.
257259
*/
@@ -265,7 +267,7 @@ for (var i = 0; i<toyotaModels.length; i++){
265267
* @param Datatype: Array `ballers`
266268
* @return Datatype: Array
267269
*
268-
* The function will loop through the players array and will put all the even numbered indexed players in the empty east array and the rest in the empty west array.
270+
* The function will loop through the players array and will put all the even number indexed players in the `east` array and the rest in the `west` array.
269271
* Console.log both the east and west arrays.
270272
*/
271273

@@ -297,7 +299,7 @@ Final Boss
297299
* @param Datatype: String `str`
298300
* @return Datatype: Array
299301
*
300-
* The function will loop through the string value and put all the letters into an array, except for the letter "A" and "a". We don't want no stinking "A" or "a" in our array.
302+
* The function will loop through the string value and put all the letters into an array, except for the letter "A" and "a". We don't want no stinking "A" or "a" in our array. Test your function with the `phrase` below!
301303
*/
302304

303305
var phrase = "An apple a day keeps Alice feeling awesome!"

0 commit comments

Comments
 (0)