Ensure that the builder isn't too long

This commit is contained in:
2023-11-19 12:53:07 +01:00
parent 8b8d424011
commit 03c4f786f7

View File

@@ -37,7 +37,9 @@ function composeDigit(digit) {
clearTimeout(taskId); clearTimeout(taskId);
taskId = null; taskId = null;
} }
if (builder.length < CODE.length) {
builder += digit.toString(); builder += digit.toString();
}
display.innerText = builder + '_'.repeat(CODE.length - builder.length); display.innerText = builder + '_'.repeat(CODE.length - builder.length);
light.classList.remove(IS_SUCCESS, IS_ERROR); light.classList.remove(IS_SUCCESS, IS_ERROR);
if (CODE.startsWith(builder)) { if (CODE.startsWith(builder)) {