-
-
Notifications
You must be signed in to change notification settings - Fork 96
ITP JAN 25 | KatarzynaKazimierczuk | Data Groups | Sprint1 #474
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
base: main
Are you sure you want to change the base?
Conversation
Hi @katarzynakaz Please make sure to add a |
|
||
if (list.length % 2 === 0) { | ||
const median = (list[middleIndex-1] + list[middleIndex]) /2; | ||
return median; |
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.
You could return the result of (list[middleIndex-1] + list[middleIndex]) /2
right away instead of assign the value to a median variable as median won't be used again.
@@ -1 +1,11 @@ | |||
function dedupe() {} | |||
function dedupe(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.
Good job using includes() and push() with new array. There is another solution using Set object
As a bonus challenge, can you come up with another solution as well?
return filtered[0] | ||
} else { | ||
//find max | ||
return Math.max(...filtered) |
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.
Can you explain why we need to use spread operator with Math.max() here?
Well done! I've added comments. Please let me know if you have any questions. I don't see sum.js and includes.js in your PR. Did you complete those tasks? Please add all required files for Sprint 1. |
Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
Questions
Ask any questions you have for your reviewer.