Rosetta Code Challenges - 100 doors

Tell us what’s happening:

i don’t know but my solution is not accepting by the freecodecamp online IDE. The results are exact but i don’t know why?

Your code so far

function getFinalOpenedDoors(numDoors) {
    //initialize all the doors initially to zero
      doors = []
      final_res=[]
      for (let i=0; i<numDoors; i++){
        doors.push(0)
      }
      for(let i=0; i<numDoors; i++){
        doors = doors.map((x, j)=>{
            if((j+1)%(i+1)==0){
                return !x
            }else{
                return x
            }
          })
      }
      doors.map((x, i)=>{
        if(x){
            final_res.push(i+1)
        }
      })
      console.log(final_res)
      return final_res;
}

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36

Challenge Information:

Rosetta Code Challenges - 100 doors

Editor on page runs in a strict mode, this means every variable has to be declared.