Typescript way to optimise nested for loop

I have the following nested for loop in my code. this works fine but i am not sure whether this is a good way to do it.i would like to know what is the best optimised way to handle such cases in typescript to get rid of for loops.

for (let j = 0; j <= list.length - 1; j++) {
    const student = list[j];
    for (let i = 0; i <= selectedStudent.subs.length - 1; i++) {
      const id = selectedStudent.subs[i].id;
         if(student[id] === id){
            console.log(id);
          }
    }
  }