Assignment
Create a student information system that:
- Creates an object representing a student with the following properties:
name(string)age(number)courses(array of at least 3 course names)grade(object with course names as keys and grades as values)isActive(boolean)
- Create a function called
getStudentInfothat takes a student object as parameter and returns a formatted string with all student information - Create a function called
calculateAveragethat takes a student object and calculates the average of all grades - Display the student information and average grade using
document.write() - Use a
for...inloop to iterate through the grade object and display each course and its grade
Requirements:
- Use object methods (functions inside objects)
- Use template literals for formatting
- Handle the nested object structure (grade object)
- Use an external JavaScript file (script.js) linked to your HTML
Create an index.html file and a script.js file with your solution.