100 doors problem[done]

my output is [1, 4, 9, 16, 25, 36, 49, 64, 81]
i don’t know where iam going wrong
NOTE: Never mind i figured it out
This is the solution

function getFinalOpenedDoors (numDoors) {
  // Good luck!
  let doors=new Array(numDoors).fill("closed");
  
  
for(let i=0;i<100;i++)
  {
        for(let j=i;j<100;j=j+i+1)
      {
        
          if(doors[j]==='closed')
          {
            doors[j]="open";
          } 
          else if(doors[j]==='open')
          {
            doors[j]="closed";
          }
      }
  }
  var check=[];
  for(let j=0;j<100;j++)
      {
        
          if(doors[j]==='open')
          {
            check.push(j+1);
          } 
      }
      console.log(check);
return check;
}

You should post a link to the question so we can see what your function is supposed to do.

You should also post your solution so that people in the future can get clues from your problem/solution