For breaking a loop in javascript you can use .some() functional method, which return false as default, but you can return true (with a break functionality), when your condition passed. For example:
const arrayList = [false, true, false, false];
arrayList.some(arrayItem => {
if (arrayItem === true ) {
// your business logic...
return true;
}
});
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
For breaking a loop in javascript you can use .some() functional method, which return false as default, but you can return true (with a break functionality), when your condition passed. For example:
const arrayList = [false, true, false, false];
arrayList.some(arrayItem => {
if (arrayItem === true ) {
// your business logic...
return true;
}
});