How to ignore infinite loop potential?

My solution works in but it takes a bit to get there. How do I turn off infinite loop protections?

figured it out.


At the begining of the solution

Needed this for the least common multiplier one.
If your curious about my solution, here it is. Warning for spoilers.

function smallestCommons(arr) {
	done = false;
	index = Math.max(...arr);
	do {
	    done = true;
	    for(var i = Math.min(...arr); i < Math.max(...arr); i++){
	        if(index % i != 0){
	            console.log(index + ' is not the smallestCommon');
	            done = false;
	            index += Math.max(...arr);
	} while(!done);
	console.log(index + ' is the smallestCommon');
	return index;

smallestCommons([1, 5]);

If you want to challenge yourself, there are efficient enough solutions that you don’t need to turn the protection off.

1 Like