-
-
Notifications
You must be signed in to change notification settings - Fork 176
Glasgow | 25-ITP-SEP | Mohammed Abdoon | Sprint 1| Sprint-1 #799
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
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 work overall. Please check out the comments and resubmit for review.
| } | ||
| } | ||
| return false; | ||
| const includes = (list, target) =>{ |
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.
While this may work in most JS environments, could you double check the for...of syntax and see if ther is a better way to write this.
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 got it. I didn't declare the variable 'item' properly. I should have put 'let' or 'const' before the variable. It works, but the code fails when running in strict mode ( "use strict"; ). It is safer to declare it the right way. I updated the code so the for..of syntax is better and safer.
Sprint-1/fix/median.js
Outdated
| return null; | ||
|
|
||
| // filter out non-numeric values inside the list | ||
| list = list.filter(item => Number.isInteger(item)); |
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 stuff. You’re currently using Number.isInteger() to check numbers. Could there be a better way to include floating-point numbers in your median calculation too?
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.
Yes, will be better to use Number.isFinite() instead of Number.isInteger if we want to include floating-point numbers.
I updated filter() so floating-point numbers are included.
| @@ -1 +1,7 @@ | |||
| function dedupe() {} | |||
| function dedupe(arr) { | |||
| arr = new Set(arr); // Using `new Set()` to store only unique values in the same variable | |||
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 use use of Set.
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.
Thank you ^^
Thank you so much for the review. I updated the code and made changes. |
|
Your PR couldn't be matched to an assignment in this module. Please check its title is in the correct format, and that you only have one PR per assignment. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
|
Nice work with the changes👍🏾. There might be a small issue with your PR title though. Please check it out and make sure it strictly follows the format. After that you should be all done. |
Thank you so much. I updated the PR's title. |
Learners, PR Template
Self checklist
Changelist
I've done the Sprint 1 exercises. including fixing, implementing and refactoring code.
Questions
No questions so far, thank you.