I’m working on the job interview prep section and I’m stuck on the first Rosetta Code question: 100 Doors.
What is wrong with my code?
function getFinalOpenedDoors (numDoors) {
var opened = false;
var iterator = 0;
var results = [];
for(var i = iterator; i <= numDoors.length; i + iterator) {
if(opened) {
opened = false;
}
else {
opened = true;
results.push[i];
}
iterator++;
}
return results;
}
Hello,
I am bit confused about Rosetta Code. In which programming language can we write solutions?
I tried in JavaScript, but when I write console.log("Hello World!");
I don’t get nothing printed on my console. I need this in order to be able to verify my steps.
I made the assumption that these challenges were like some of the Learn You Node challenges where there is some code being passed to you behind the scenes i.e. they are taking care of the array itself. It appears that isn’t the case.