Rosetta Code: 100 doors not correct result

Tell us what’s happening:
I don’t understand what I am wrong. what is the outcome of the result.

Your code so far

function getFinalOpenedDoors(numDoors) {
// Good luck!
var arr = [...Array(numDoors).keys()]
for(var i = 1; i <= numDoors; i++){
    arr =, j) => {
            if(j % i === 0)
              return !x;
              return x;
return arr;          

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:74.0) Gecko/20100101 Firefox/74.0.

Challenge: 100 doors

Link to the challenge: