Check if brackets are balanced or not in javascript

Check if brackets are balanced or not in javascript

//input - a string of brackets
//output - true or false
 const balancedBrackets = (str) => {
const stack = [];
let openers = [ "{", "[", "(" ];
let closers = [ "}", "]", ")" ];
let dict = {
'{' : '}',
'[' : ']',
'(' : ')'
}
 for (let i = 0; i < str.length; i++) {
if (openers.includes(str[i])) {
stack.push(str[i]);
} else if (closers.includes(str[i])) {
if (stack.length === 0)
return false;
else if (dict[stack.pop()] === str[i] )
return false;
}
}
return stack.length === 0;
}
console.log(balancedBrackets("{[(]}")); //returns false
console.log(balancedBrackets("{[(]}")); //returns true