Can't run my loop because of infinte loop protection, so where?

I am trying to find an editor where I can run my code. I am trying to solve the second part of the first challenge for the advent of code, and I need to loop various times on a long array to have the solution. I have tried downloading Brackets but it seems I don’t know how to use it.
the issue is that it needs many iterations to arrive to the number that is repeated twice, so codepen.io doesn’t give enough time to arrive to the result
could you advise on what I could do? where I could run it?

function advent(array) {
    var frequency = [0];
    var n= 0;
    for (var i = 0; i < array.length; i++) {
        n+=array[i];
        if (frequency.includes(n)) {
            console.log("this is the frequency that appears twice: " + currentN);
            return n;
        }
    frequency.push(n);
    if (i+1 === array.length) {i = -1;}
    }
}

advent(numbers);

https://repl.it might be a little more forgiving. What challenge is that?

1 Like

I am going to try it, thank you
second part of day 1 https://adventofcode.com/

thank you very much! it worked!

1 Like