jseremba/Binary-Gap-solution-Javascript

Purpose of line

Opened this issue · 2 comments

for (startIndexFromEnd; startIndexFromEnd >= 0; startIndexFromEnd--) {
if (binStr.charAt(startIndexFromEnd) != '0') {
break;
}
}

Please what is the purpose of the above line?

That is to check if the last number of binary is not 1.

why would yo do that?