EXERCISE 5: Objects - Student Information

Assignment

Create a student information system that:

  1. 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)
  2. Create a function called getStudentInfo that takes a student object as parameter and returns a formatted string with all student information
  3. Create a function called calculateAverage that takes a student object and calculates the average of all grades
  4. Display the student information and average grade using document.write()
  5. Use a for...in loop 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.