Somebody should, please tell me what’s with this code.
const myBtn = document.querySelector('button');
const inputF = document.querySelector('input');
myBtn.addEventListener('click', function () {
if (inputF.value === 'sam') {
break breaker;
}
});
breaker: while (true) {
console.log('infinite');
}
// breaker: for (;;) {
// console.log('infinite');
// }
i’m getting Uncaught SyntaxError: Undefined label 'breaker'
error.
I’m am trying to make infinite loop break on button click.