write a program in js to print student list with courses and score [closed]

program explanation:
first ask student name & course1 & score of course1 from user.
then ask if student have more courses?
if yes add another course with score
if not ask user if new student needed
if yes define new student with his cources and score and add to student list
if not print student list;
i write following code but it works only work for one student.

var studentList = [];

function addnewstudent() {
  var studentInfo = {
    name: '',
    courses: {}
  }
  var studentName = prompt("name");
  studentInfo.name = studentName;
  var newLesson = prompt("new course");
  var score = prompt("nomre");
  for (label in studentInfo) {
    if (typeof studentInfo[label] === 'object') {
      studentInfo[label][newLesson] = score;
    }
  }
  studentList.push(studentInfo);
  console.log(studentList);
}
addnewstudent();