there's a test case that makes it possible for my algorithm to get into an infinite loop
https://www.freecodecamp.com/challenges/drop-it
Version: 39.0.2256.71 - Opera is up to date
Update stream: Stable
System: Windows 10 64-bit (WoW64)
while(!func(arr[0])){arr.shift();}
Thank you.
@alevis There seems to be a problem in your code.
In the condition for the while loop, try using the correct condition (i.e. the second argument func instead of function)
Here's the code that'll solve the problem:
function dropElements(arr, func) {
while(!func(arr[0])) {
arr.shift();
}
return arr;
}
dropElements([1, 2, 3], function(n) {return n < 3; });
@ryzokuken thanks for catching the typo.
However whenever I navigate to http://www.freecodecamp,com/challenges/drop-it my code gets executed right away resulting in the infinite loop. If there was a way to stop code execution when I navigate to that page, that would solve it.
Try clearing the browser cache. I suppose your solution is stored locally
check this out: https://github.com/freecodecamp/freecodecamp/wiki/FreeCodeCamp-Disable-Code-Autorun
try to add query string run=disabled to your URL
@alevis check out the link that @ivantedja has pointed out above. If you get stuck or have questions with a challenge in the future, please first ask questions to the Help Room. Happy coding!
Most helpful comment
check this out: https://github.com/freecodecamp/freecodecamp/wiki/FreeCodeCamp-Disable-Code-Autorun
try to add query string
run=disabledto your URL