second commit

pull/1159/head
braxclerk 2 years ago
parent 207136a537
commit 6506e3449c

@ -0,0 +1,28 @@
let allStudents = [
'A',
'B-',
1,
4,
5,
2
]
let studentsWhoPass = [];
for (let i = 0; i < allStudents.length; i++){
let studentGrade = allStudents[i];
if (typeof studentGrade === 'number') {
if (studentGrade >= 3) {
studentsWhoPass.push(studentGrade);
}
}
else if (typeof studentGrade === 'string') {
let passingGrades = ['A', 'A-', 'B', 'B-', 'C', 'C-'];
if (passingGrades.includes(studentGrade)) {
studentsWhoPass.push(studentGrade);
}
}
}
console.log(studentsWhoPass);
Loading…
Cancel
Save