Glasgow Class 6 - Rahma Berhan - JavaScript_1 - Week_4#231
Glasgow Class 6 - Rahma Berhan - JavaScript_1 - Week_4#231RahmaB1 wants to merge 4 commits intoCodeYourFuture:mainfrom
Conversation
annacollins85
left a comment
There was a problem hiding this comment.
Great work! Your code is well formatted and you have used good variable names throughout which makes it very easy to read and follow. This is really important for other developers to be able to work with your code. Well done! Just added a few comments for improvement but there weren't many! 👏
| return names.find(function (name) { | ||
| if (name.startsWith("A") && name.length > 7) return name; | ||
| }); | ||
| } |
| let mentors = ["Daniel", "Irina", "Mozafar", "Luke"]; | ||
|
|
||
| let pairs = pairsByIndex.map(function (indexes) { | ||
| if (pairsByIndex.some((element) => element === null)) { |
| let group = ["Austine", "Dany", "Swathi", "Daniel"]; | ||
|
|
||
| let groupIsOnlyStudents; // complete this statement | ||
| let groupIsOnlyStudents = group.every((i) => students.includes(i)); |
There was a problem hiding this comment.
This is good but I would use a more descriptive name, e.g.
| let groupIsOnlyStudents = group.every((i) => students.includes(i)); | |
| let groupIsOnlyStudents = group.every((name) => students.includes(name)); |
| let pairsByIndex = pairsByIndexRaw.filter( | ||
| (element) => Array.isArray(element) && element.length === 2 | ||
| ); |
| let firstFive; // complete this statement | ||
| let lastFive; // complete this statement | ||
| let firstFive = everyone.slice(0, 5); // complete this statement | ||
| let lastFive = everyone.slice(everyone.length - 5, everyone.length); // complete this statement |
There was a problem hiding this comment.
There's an easier way of doing this
| let lastFive = everyone.slice(everyone.length - 5, everyone.length); // complete this statement | |
| let lastFive = everyone.slice(-5) |
|
|
||
| function formatPercentage() { | ||
| function formatPercentage(numbers) { | ||
| numbersWithPercentages = numbers.map(addPercentage); |
| //ERROR --->>>> indSafeOxygenLevel function returns undefined if no valid planets found | ||
|
|
||
| function findSafeOxygenLevel(array) { | ||
| if (array.some((number) => number.includes("%"))) { |
There was a problem hiding this comment.
Why do we need this check here? Will it not always be the case?
| function checkLevel(number) { | ||
| if (number > 19.5 && number < 23.5) { | ||
| return true; | ||
| } else { | ||
| return false; | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
You could make this simpler by:
| function checkLevel(number) { | |
| if (number > 19.5 && number < 23.5) { | |
| return true; | |
| } else { | |
| return false; | |
| } | |
| } | |
| } | |
| function checkLevel(number) { | |
| return (number > 19.5 && number < 23.5); | |
| } |
| return families.filter(familyNameChecker); | ||
| } | ||
|
|
||
| function familyNameChecker(familyName) { |
There was a problem hiding this comment.
You could have used array.split(' ') to create an array and then check the last item in the array is "family" and check the first one begins with "A" but is not just "A"
| function getEligibleStudents(attendanceData) { | ||
| let studentsNameWith8Classes = []; | ||
| attendanceData.forEach((student) => { | ||
| if (student[1] >= 8) { | ||
| studentsNameWith8Classes.push(student[0]); | ||
| return true; | ||
| } | ||
| }); | ||
| return studentsNameWith8Classes; | ||
| } |
No description provided.