- 
                Notifications
    You must be signed in to change notification settings 
- Fork 22
solve task : js-arrays / date:18/7/2023 #2
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?
solve task : js-arrays / date:18/7/2023 #2
Conversation
| function isPresentIncluded(presentName, presents) { | ||
| //TODO: Add your code here | ||
| console.log("Task-3 :\n"); | ||
| if(presents.includes(presentName)==true) | 
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.
No need to use an if statement since the includes method already returns a boolean (true or false)
| if(a>b)return true; | ||
| if(b>a)return false; | ||
| } | ||
| function sortStudentsAlphabetically(students) { | 
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.
Well done, but we already have a method that sorts the array alphabetically. => (students.sort())
| - console.log(odds); // Output: [1, 3, 5, 7, 9] | ||
| - console.log(evens); // Output: [2, 4, 6, 8, 10] | ||
| **************************************************************/ | ||
| var array_odd=[]; | 
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.
Well done, we mentioned more than once not using (var) because it will result in unexpected behavior sometimes. Please stick to the instructors' instructions
| **************************************************************/ | ||
| function updateGrades(curve, students) { | ||
| //TODO: Add your code here | ||
| students.map(function(o){ | 
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.
It's not correct to mutate (change) the original array because 'map' creates a new array with changed values. We have to use the spread operator. Additionally, the solution misses a small step, which involves subtracting 'curve' from the 'nerds' type.
| I left some comments on some tasks. However, you did a great job at solving each task in your way! Well done 👏🏼 | 
| شكرا على الملاحظات القيمة و سوف يتم تعديل الحل
    بتاريخ الأربعاء، 19 تموز 2023 في 03:28:10 م غرينتش-7، ZehraaMA ***@***.***> كتب:
I left some comments on some tasks. However, you did a great job at solving each task in your way! Well done 👏🏼
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***> | 
No description provided.