-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Complete homework 10-10-10 #4
base: master
Are you sure you want to change the base?
Conversation
@@ -12,68 +12,191 @@ | |||
@Example - Sending the function a value of 10 will result in 11 | |||
@Test - Write a console.log that shows the value of `increaseLevel(10)` | |||
*/ | |||
function increaseLevel(number) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice naming and commenting.
|
||
console.log(makeEchoesOne(5)) | ||
*/ | ||
function makeEchoesTwo(numberRepeats) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Nicely done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is excellent work. There was one note on a variable i
in a loop that is not being declared using let
that will cause unexpected results. I recommend finding that code and making that fix.
string = string + msg; | ||
// the number of repeats (5) is equal to the number of repeats - 1 | ||
numberRepeats = numberRepeats - 1 | ||
// the number of repeats equals 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ great commenting
|
||
/* | ||
@Challenge 04 - Write a function named `showTheFifties` that loops from 1 to 200. | ||
function showMeTheMoney(dollars) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Solid.
Use a condition in the loop to console.log the number when it is over 49 and under 60 | ||
@Example - Expect to see 50, 51, 52, 53, 54, 55, 56, 57, 58, 59 in the terminal | ||
@Test - Make a function call of `showTheFifties()` | ||
*/ | ||
|
||
/* | ||
function showTheFifties(vintageItem) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ ✅ I like the parameter naming
// if variable is greater than 0, continue to for loop | ||
if (vintageItem > 0) { | ||
// loop 0 to 200, increasing by an increment of 1 | ||
for (let i = 0; i < 200; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a note. This loops to 199 instead of to 200.
@Challenge 05 - Write a function that returns an array that is named `getTheTwenties` that loops from 1 to 60 and returns an array of all the 20's | ||
Use a condition in the loop to push to an array when the number is greater than or equal to 20 and under 30 | ||
@Example - Expect an array returned with value of [20, 21, 22, 23, 24, 25, 26, 27, 28, 29] | ||
@Test - console.log the result of a function call of `getTheTwenties()` and expect to see an array value of [20, 21, 22, 23, 24, 25, 26, 27, 28, 29] | ||
*/ | ||
|
||
/* | ||
function getTheTwenties(twenties) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Nice
sayin: 'I am a crow!' | ||
} | ||
] | ||
function getEveryLittleThing(arr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of great effort in here practicing array methods. I love to see it. ✅ ✅
console.log(letters) | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ I like the use of forEach
"4 Gallons Remaining" | ||
"3 Gallons Remaining" | ||
"2 Gallons Remaining" | ||
"1 Gallons Remaining" | ||
in the terminal | ||
@Test - Make a function call of `trackGallonsUsed(5)` | ||
*/ | ||
function trackGallonsUsed(gallons) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Great work
// set the count to equal gallons remaining + the message | ||
count = gallons + msg; | ||
// reduce the number of gallons by 1 | ||
gallons -= 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice use of the shorthand -=
@Challenge 10 - Write a function named `getHighScore` that finds the highest value in an array of scores | ||
@Example - Sending the function a value of [1999,2020,3080,1111] will result in 3080 | ||
@Test - Write a console.log that shows the value of `getHighScore([1999,2020,3080,1111])` | ||
*/ | ||
|
||
function getHighScore(score) { | ||
// found this Math.max which is supposed to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great comment. Thanks for adding it.
Math.max(...[1999, 2020, 3080, 1111])
is a similar use as well. I was thinking everyone would solve this with a loop. I like this unique solution. Great work.
No description provided.