Implement Bubble Sort - loop exit too early

Tell us what’s happening:
Looking at the debugger, looks like the loop exit too early due to a _LP variable that check for elapsed time. It’s very strange the loop protection is activated just to enumerate an array and print its values.

Your code so far


function bubbleSort(array) {
  // change code below this line
  const length = array.length;
  console.log(length);
  for(let i=0; i<length; i++)
    console.log(i);
  // change code above this line
  return array;
}

// test array:
// [1, 4, 2, 8, 345, 123, 43, 32, 5643, 63, 123, 43, 2, 55, 1, 234, 92]

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/coding-interview-prep/algorithms/implement-bubble-sort/

The loop protection is enabled on all loops really

It’s kicking in here because printing with the console is actually fairly expensive, depending on the implementation in the browser

It’s cutting off loops after around 100ms

I don’t see anything in your code that looks like it would time out. You’re just logging 18 numbers.

What indication do you have that it is exiting early?