Yep – works in all loops.
const myObject = {
propA: 'foo',
propB: 'bar'
};
for (let propName in myObject) {
console.log(propName);
if (propName !== 'propA') {
continue;
}
else if (propName === 'propA') {
break;
}
}
(By loops I mean for, for...in, for...of, while and do...while, not forEach, which is actually a function defined on the Array prototype.)