filmov
tv
JavaScript for Beginners #66 Coding Challenge 12

Показать описание
Here, we will look at another coding challenge. In this video, we will be given an array of objects that contain information about some students. Our job will be to find the student's average score, letter grade, and whether they have passed or failed using the reduce array method.
0:00 Introduction
1:26 Going through the coding challenge instructions
2:40 Using the reduce array method to find our average score
4:25 Finding the pass/fail status
5:22 Finding the letter grade
6:40 Using the forEach array method to add in our properties
8:46 Finding the highest average score using the reduce array method
12:01 Finding the lowest average score using the reduce array method
/*
Write a method to find each student's average score, whether they have passed or failed, and their letter grade.
Store these values in the object using the property names: average, passed, and letterGrade.
A student will pass if they have a 70 or higher.
Letter grades are on a 10 point scale:
90 or above is an A
80 to 89 is a B
70 to 79 is a C
60 to 69 is a D
59 or below is an F
Lastly, find the highest average score and the lowest average score for the class.
*/
class Student {
constructor(fullName, lvl, tests) {
}
getSummary() {
}
}
const student1 = new Student("Michael Fisher", "Junior", [91, 79, 82, 85, 97, 75]);
const student2 = new Student("Sean Payne", "Senior", [65, 90, 71, 62, 60, 80]);
const student3 = new Student("Jessica Wilkins", "Freshman", [100, 91, 95, 90, 89, 80, 92, 97]);
const student4 = new Student("Vanessa Nolan", "Sophomore", [80, 60, 55, 51, 60, 42]);
const student5 = new Student("Gary Anderson", "Freshman", [80, 75, 77, 70, 71]);
const student6 = new Student("Kim Lee", "Junior", [99, 98, 100, 94, 90]);
const student7 = new Student("Rachel Smith", "Freshman", [50, 41, 43, 90, 81, 55, 57, 91]);
const student8 = new Student("Stephanie Nolan", "Senior", [95, 80, 85, 70, 100, 100]);
const myClass = [student1, student2, student3, student4, student5, student6, student7, student8];
JavaScript Playlist:
MDN Reduce:
NodeJS:
VS Code:
0:00 Introduction
1:26 Going through the coding challenge instructions
2:40 Using the reduce array method to find our average score
4:25 Finding the pass/fail status
5:22 Finding the letter grade
6:40 Using the forEach array method to add in our properties
8:46 Finding the highest average score using the reduce array method
12:01 Finding the lowest average score using the reduce array method
/*
Write a method to find each student's average score, whether they have passed or failed, and their letter grade.
Store these values in the object using the property names: average, passed, and letterGrade.
A student will pass if they have a 70 or higher.
Letter grades are on a 10 point scale:
90 or above is an A
80 to 89 is a B
70 to 79 is a C
60 to 69 is a D
59 or below is an F
Lastly, find the highest average score and the lowest average score for the class.
*/
class Student {
constructor(fullName, lvl, tests) {
}
getSummary() {
}
}
const student1 = new Student("Michael Fisher", "Junior", [91, 79, 82, 85, 97, 75]);
const student2 = new Student("Sean Payne", "Senior", [65, 90, 71, 62, 60, 80]);
const student3 = new Student("Jessica Wilkins", "Freshman", [100, 91, 95, 90, 89, 80, 92, 97]);
const student4 = new Student("Vanessa Nolan", "Sophomore", [80, 60, 55, 51, 60, 42]);
const student5 = new Student("Gary Anderson", "Freshman", [80, 75, 77, 70, 71]);
const student6 = new Student("Kim Lee", "Junior", [99, 98, 100, 94, 90]);
const student7 = new Student("Rachel Smith", "Freshman", [50, 41, 43, 90, 81, 55, 57, 91]);
const student8 = new Student("Stephanie Nolan", "Senior", [95, 80, 85, 70, 100, 100]);
const myClass = [student1, student2, student3, student4, student5, student6, student7, student8];
JavaScript Playlist:
MDN Reduce:
NodeJS:
VS Code: