Check whether string of braces, brackets, and parentheses is balanced
Your solution is complicated due to the use of three separate stacks:


For each closing character, you have to cross-validate the two other types of delimiters.  (If you had to handle a fourth type of matching characters, such as &lt; and &gt;, it would be even messier.)
At the end, you need to write !Object.values(brace).flat().length to verify that all of the stacks have been cleared.


I also think that the use of Object.freeze() is overkill.

Your removeBrace() helper can use Array.prototype.pop() instead.

Suggested solution

Keep all of the state in one combined stack.



const areBracesBalanced = brs =&gt; {
  let expectCloseStack = [];
  return [...brs].every(b =&gt; {
    switch (b) {
      case "(": return expectCloseStack.push(")");
      case "[": return expectCloseStack.push("]");
      case "{": return expectCloseStack.push("}");

      case ")":
      case "]":
      case "}":
        return expectCloseStack.pop() === b;
    }
  }) &amp;&amp; !expectCloseStack.length;
};

console.log(areBracesBalanced("[({})](]"));