-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Update functions-and-arrays.js #1620
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
Conversation
@@ -1,73 +1,431 @@ | ||
// Iteration #1: Find the maximum | ||
|
||
var maxOfTwoNumbers = [5, 7]; | ||
|
||
function findMax(array) { |
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.
- The function should have two separate arguments, not an array as an argument.
- The function is named incorrectly and is not logging the result if the second number is highest.
I don't fully understand: | ||
You can use rest parameter (...) syntax | ||
allows us to represent an indefinite number of arguments as an array.*/ | ||
function findLongestWord(...strs) { |
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 function is spreading an array that is getting from a callback. This was not how it was asked in the instructions.
// Iteration #3: Calculate the sum | ||
|
||
const numbers = [6, 12, 1, 18, 13, 16, 2, 1, 8, 10]; | ||
|
||
var sumNumbers = numbers.reduce(function(a, b) { |
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 should have been a function as instructed in the repo.
// Iteration #4: Calculate the average | ||
// Level 1: Array of numbers | ||
const numbersAvg = [2, 6, 9, 10, 7, 4, 1, 9]; | ||
var sumNumbers = numbersAvg.reduce(function(a, b) { |
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 should have been a function as instructed in the repo.
"palace" | ||
]; | ||
// I'm not sure about this | ||
averageWordLength = wordsArr.join("").length / wordsArr.length; |
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.
variable is not declared. Also, this should have been a function as instructed in the repo.
Okay, I'm seeing that yesterday it was a disaster. I'll try to fix it.
Thanks a lot!
Ricard
El mié., 1 abr. 2020 a las 20:15, tawebbcn (<notifications@github.com>)
escribió:
… ***@***.**** commented on this pull request.
------------------------------
In src/functions-and-arrays.js
<#1620 (comment)>
:
> // Iteration #4: Calculate the average
// Level 1: Array of numbers
const numbersAvg = [2, 6, 9, 10, 7, 4, 1, 9];
+var sumNumbers = numbersAvg.reduce(function(a, b) {
This should have been a function as instructed in the repo.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1620 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOYLJIJ5BXFNDES2SBYSQFTRKOAC7ANCNFSM4LX6KJMA>
.
|
"disobedience" | ||
]; | ||
var x = ["machine"]; | ||
function doesWordExist(wordsFind, x) { |
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.
function is not returning anything.
Some of the Iterations show results that match the asked solution, however, neither the instructions in the repo nor the Jasmine testing were followed properly. It is good that you used more advanced methods like .includes, .sort and .reduce. However, the Lab was about using the resources seen in the lectures. Overall there is good use of logic in the code but for next Labs try to follow instructions correctly and ask us for help if you don't understand something. |
Okay, next time I'll have a block I'll ask for help!
El mié., 1 abr. 2020 a las 20:26, tawebbcn (<notifications@github.com>)
escribió:
… Closed #1620
<#1620>
.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1620 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOYLJIIB4X7JXHIOCG32DT3RKOBO3ANCNFSM4LX6KJMA>
.
|
Okay, sorry about that, next time I'll have a block I'll ask for help!
El mié., 1 abr. 2020 a las 20:26, tawebbcn (<notifications@github.com>)
escribió:
… Some of the Iterations show results that match the asked solution,
however, neither the instructions in the repo nor the Jasmine testing were
followed properly. It is good that you used more advanced methods like
.includes, .sort and .reduce. However, the Lab was about using the
resources seen in the lectures. Overall there is good use of logic in the
code but for next Labs try to follow instructions correctly and ask us for
help if you don't understand something.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1620 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOYLJIPB2MXHKUA2WMZRYADRKOBONANCNFSM4LX6KJMA>
.
|
is not finished yet, I'm on it (6 and 7 don work). I dit the pull request just in case.