const areBracketsBalanced = (str) => {
let opened = '('
for (let char in str) {
let i = 0
if (str[char] === opened) {
i += 1
} else {
i -= 1
}
return i === 0
}
};
let i = 0;
…
let i = 0
for (let char in str) {
…